﻿<!--***********************************************************************************

   Extended WPF Toolkit

   Copyright (C) 2007-2013 Xceed Software Inc.

   This program is provided to you under the terms of the Microsoft Public
   License (Ms-PL) as published at http://wpftoolkit.codeplex.com/license 

   For more features, controls, and fast professional support,
   pick up the Plus Edition at http://xceed.com/wpf_toolkit

   Stay informed: follow @datagrid on Twitter or Like http://facebook.com/datagrids

  **********************************************************************************-->

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:local="clr-namespace:Xceed.Wpf.DataGrid"
                    xmlns:markup="clr-namespace:Xceed.Wpf.DataGrid.Markup"
                    xmlns:views="clr-namespace:Xceed.Wpf.DataGrid.Views"
                    xmlns:conv="clr-namespace:Xceed.Wpf.DataGrid.Converters">

   <ResourceDictionary.MergedDictionaries>

      <!-- Include the view independant and color-scheme independant theme resources -->
      <markup:DataGridThemeResourceDictionary Source="Resources/Aero.Resources.xaml" />

      <!-- Include the view dependant and color-scheme independant theme graphics -->
      <markup:DataGridThemeResourceDictionary Source="Resources/TableView.Aero.Graphics.xaml" />

      <!-- Include the view independant and color-scheme dependant theme resources -->
      <markup:DataGridThemeResourceDictionary Source="Resources/Aero.normalcolor.Resources.xaml" />

      <!-- Include the standard grid element templates -->
      <markup:DataGridThemeResourceDictionary Source="../Common/TableflowView.GridElementTemplates.xaml" />

   </ResourceDictionary.MergedDictionaries>

   <!-- =================================================================== -->
   <!-- Resources specific to this View/Theme/ColorScheme                   -->
   <!-- =================================================================== -->

   <SolidColorBrush x:Key="hotRowBorderBrush"
                    Color="#CDEFFE" />

   <SolidColorBrush x:Key="warningBackgroundBrush"
                    Color="#FFC400" />

   <SolidColorBrush x:Key="warningForegroundBrush"
                    Color="Black" />

   <LinearGradientBrush x:Key="hotOuterRowBackgroundBrush"
                        StartPoint="0.5,0"
                        EndPoint="0.5,1">

      <GradientStop Offset="0"
                    Color="#F8FCFD" />

      <GradientStop Offset="1"
                    Color="#EFF8FD" />

   </LinearGradientBrush>

   <LinearGradientBrush x:Key="hotInnerRowBackgroundBrush"
                        StartPoint="0.5,1"
                        EndPoint="0.5,0">

      <GradientStop Offset="1"
                    Color="#F3FAFD" />

      <GradientStop Offset="0"
                    Color="#E2F3FC" />

   </LinearGradientBrush>

   <SolidColorBrush x:Key="selectionRowBorderBrush"
                    Color="#99DEFD" />

   <LinearGradientBrush x:Key="selectionOuterRowBackgroundBrush"
                        StartPoint="0.5,0"
                        EndPoint="0.5,1">

      <GradientStop Offset="0"
                    Color="#E7F5FD" />

      <GradientStop Offset="1"
                    Color="#F6FBFD" />

   </LinearGradientBrush>

   <LinearGradientBrush x:Key="selectionInnerRowBackgroundBrush"
                        StartPoint="0.5,1"
                        EndPoint="0.5,0">

      <GradientStop Offset="1"
                    Color="#F1F8FD" />

      <GradientStop Offset="0"
                    Color="#D5EFFC" />

   </LinearGradientBrush>

   <SolidColorBrush x:Key="inactiveSelectionRowBorderBrush"
                    Color="#D9D9D9" />

   <LinearGradientBrush x:Key="inactiveSelectionOuterRowBackgroundBrush"
                        StartPoint="0.5,0"
                        EndPoint="0.5,1">

      <GradientStop Offset="0"
                    Color="#FAFAFB" />

      <GradientStop Offset="1"
                    Color="#F0F0F0" />

   </LinearGradientBrush>

   <LinearGradientBrush x:Key="inactiveSelectionInnerRowBackgroundBrush"
                        StartPoint="0.5,1"
                        EndPoint="0.5,0">

      <GradientStop Offset="1"
                    Color="#F8F8F8" />

      <GradientStop Offset="0"
                    Color="#E5E5E5" />

   </LinearGradientBrush>

   <SolidColorBrush x:Key="hotSelectionRowBorderBrush"
                    Color="#B6E6FB" />

   <LinearGradientBrush x:Key="hotSelectionOuterRowBackgroundBrush"
                        StartPoint="0.5,0"
                        EndPoint="0.5,1">

      <GradientStop Offset="0"
                    Color="#F2F9FD" />

      <GradientStop Offset="1"
                    Color="#DEF1FC" />

   </LinearGradientBrush>

   <LinearGradientBrush x:Key="hotSelectionInnerRowBackgroundBrush"
                        StartPoint="0.5,1"
                        EndPoint="0.5,0">

      <GradientStop Offset="1"
                    Color="#E8F6FD" />

      <GradientStop Offset="0"
                    Color="#C4E8FA" />

   </LinearGradientBrush>

   <LinearGradientBrush x:Key="verticalHeaderBackgroundBrush"
                        StartPoint="0,0.5"
                        EndPoint="1,0.5">

      <GradientStop Offset="0"
                    Color="#FFFFFF" />

      <GradientStop Offset="1"
                    Color="#F0F1F4" />

   </LinearGradientBrush>

   <LinearGradientBrush x:Key="horizontalHeaderBackgroundBrush"
                        StartPoint="0.5,0.99074"
                        EndPoint="0.5,0.0370377">

      <GradientStop Offset="0.589"
                    Color="#F1F2F4" />

      <GradientStop Offset="0.609"
                    Color="#FFFFFF" />

   </LinearGradientBrush>

   <SolidColorBrush x:Key="headerForegroundBrush"
                    Color="Black" />

   <SolidColorBrush x:Key="rowSelectorBorderBrush"
                    Color="#D5D5D5" />

   <SolidColorBrush x:Key="rowSelectorDelimiterBorderBrush"
                    Color="#FCFCFD" />

   <LinearGradientBrush x:Key="rowSelectorBackgroundBrush"
                        StartPoint="0,0.5"
                        EndPoint="1,0.5">

      <GradientStop Offset="0"
                    Color="#FFFFFF" />

      <GradientStop Offset="1"
                    Color="#F0F1F4" />

   </LinearGradientBrush>

   <LinearGradientBrush x:Key="rowSelectorHotBackgroundBrush"
                        StartPoint="0,0.5"
                        EndPoint="1,0.5">

      <GradientStop Offset="0"
                    Color="#F2F9FC" />
      <GradientStop Offset="0.956"
                    Color="#DDEEF7" />

   </LinearGradientBrush>

   <LinearGradientBrush x:Key="rowSelectorPressedBackgroundBrush"
                        StartPoint="0,0.5"
                        EndPoint="1,0.5">

      <GradientStop Offset="0"
                    Color="#AACEE1" />

      <GradientStop Offset="1"
                    Color="#8BD0F5" />

   </LinearGradientBrush>

   <LinearGradientBrush x:Key="columnManagerCellBorderBrush"
                        StartPoint="0.482673,0.99074"
                        EndPoint="0.482673,0.0370377">

      <GradientStop Offset="0"
                    Color="#D5D5D5" />

      <GradientStop Offset="0.029"
                    Color="#D5D5D5" />

      <GradientStop Offset="0.0498"
                    Color="#DEDFE1" />

      <GradientStop Offset="0.585"
                    Color="#DEDFE1" />

      <GradientStop Offset="0.604"
                    Color="#F2F2F2" />

      <GradientStop Offset="1"
                    Color="#F2F2F2" />

   </LinearGradientBrush>

   <SolidColorBrush x:Key="columnManagerCellDelimiterBorderBrush"
                    Color="White" />

   <LinearGradientBrush x:Key="columnManagerCellBackgroundBrush"
                        StartPoint="0.482673,0.99074"
                        EndPoint="0.482673,0.0370377">

      <GradientStop Offset="0"
                    Color="#F1F2F4" />

      <GradientStop Offset="0.589"
                    Color="#F1F2F4" />

      <GradientStop Offset="0.609"
                    Color="#FFFFFF" />

      <GradientStop Offset="1"
                    Color="#FFFFFF" />

   </LinearGradientBrush>

   <SolidColorBrush x:Key="columnManagerCellHotBorderBrush"
                    Color="#96D9F9" />

   <LinearGradientBrush x:Key="columnManagerCellHotBackgroundBrush"
                        StartPoint="0.483,0.99"
                        EndPoint="0.483,0.037">

      <GradientStop Offset="0"
                    Color="#DDEEF7" />

      <GradientStop Offset="0.589"
                    Color="#DDEEF7" />

      <GradientStop Offset="0.609"
                    Color="#F2F9FC" />

      <GradientStop Offset="1"
                    Color="#F2F9FC" />

   </LinearGradientBrush>

   <LinearGradientBrush x:Key="columnManagerCellPressedBorderBrush"
                        StartPoint="0.483,0.991"
                        EndPoint="0.483,0.037">

      <GradientStop Offset="0"
                    Color="#93C9E3" />

      <GradientStop Offset="0.0292"
                    Color="#93C9E3" />

      <GradientStop Offset="0.0498"
                    Color="#69BBE3" />

      <GradientStop Offset="0.585"
                    Color="#69BBE3" />

      <GradientStop Offset="0.604"
                    Color="#88CBEB" />

      <GradientStop Offset="1"
                    Color="#88CBEB" />

   </LinearGradientBrush>

   <LinearGradientBrush x:Key="columnManagerCellPressedBackgroundBrush"
                        StartPoint="0.482,0.990"
                        EndPoint="0.483,0.037">

      <GradientStop Offset="0"
                    Color="#BCECFE" />

      <GradientStop Offset="0.589"
                    Color="#BCECFE" />

      <GradientStop Offset="0.609"
                    Color="#E3F7FF" />

      <GradientStop Offset="1"
                    Color="#E3F7FF" />

   </LinearGradientBrush>

   <SolidColorBrush x:Key="groupByControlForegroundBrush"
                    Color="White" />

   <Pen x:Key="groupByConnectionLinePen"
        Thickness="2"
        Pen.Brush="White" />

   <!-- =================================================================== -->
   <!-- Templates specific to this View/Theme/ColorScheme                   -->
   <!-- =================================================================== -->

   <!--**************************
    * TEMPLATE: GroupNavigationControl
    ************************** -->
   <ControlTemplate x:Key="tableflowViewGroupNavigationControlTemplate"
                    TargetType="{x:Type local:GroupNavigationControl}">

      <Grid>
         <Border x:Name="outlineBorder"
                 BorderBrush="#FF03395B"
                 BorderThickness="1"
                 Background="#00FFFFFF"
                 CornerRadius="4"
                 Opacity="0" />
         <Border x:Name="innerBorder"
                 BorderBrush="#CC82B9D8"
                 BorderThickness="1"
                 CornerRadius="3"
                 Margin="1"
                 Opacity="0" />

         <Grid>
            <Grid.ColumnDefinitions>
               <!-- Button part -->
               <ColumnDefinition Width="*" />

               <!-- Seperator part -->
               <ColumnDefinition Width="Auto" />

               <!-- Toggle button part -->
               <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>

            <Button x:Name="PART_Button"
                    Command="local:GroupNavigationButton.NavigateToGroup"
                    CommandParameter="{TemplateBinding Group}"
                    Content="{TemplateBinding Group}"
                    ContentTemplate="{TemplateBinding MainItemTemplate}"
                    ContentTemplateSelector="{TemplateBinding MainItemTemplateSelector}"
                    Foreground="{TemplateBinding Foreground}"
                    Focusable="False"
                    Grid.Column="0">
               <Button.Template>
                  <ControlTemplate TargetType="{x:Type Button}">
                     <Border Background="Transparent">
                        <ContentPresenter Margin="4,2,4,2" />
                     </Border>
                  </ControlTemplate>
               </Button.Template>
            </Button>

            <Border x:Name="seperator"
                    Grid.Column="1"
                    BorderThickness="0,0,1,0"
                    BorderBrush="#CC82B9D8"
                    Margin="0,4"
                    Visibility="Hidden" />

            <ToggleButton x:Name="PART_ToggleButton"
                          Focusable="False"
                          IsChecked="{Binding Path=IsDropDownOpen,Mode=TwoWay,RelativeSource={RelativeSource TemplatedParent}}"
                          Grid.Column="2"
                          Foreground="{TemplateBinding Foreground}">
               <ToggleButton.Template>
                  <ControlTemplate>
                     <Border x:Name="toggleButtonBackground"
                             CornerRadius="0,6,6,0"
                             Background="Transparent">
                        <Path x:Name="Arrow"
                              Fill="{TemplateBinding Foreground}"
                              Margin="7,1,7,1"
                              HorizontalAlignment="Center"
                              VerticalAlignment="Center"
                              Data="M 0 0 L 4 4 L 0 8 Z"
                              Opacity="0.3" />
                     </Border>

                     <ControlTemplate.Triggers>
                        <Trigger Property="ToggleButton.IsMouseOver"
                                 Value="True">
                           <Setter TargetName="Arrow"
                                   Property="Opacity"
                                   Value="1" />
                        </Trigger>
                        <Trigger Property="ToggleButton.IsChecked"
                                 Value="True">
                           <Setter TargetName="Arrow"
                                   Property="Opacity"
                                   Value="1" />
                           <Setter TargetName="Arrow"
                                   Property="Margin"
                                   Value="5,1,5,1" />
                           <Setter TargetName="Arrow"
                                   Property="Data"
                                   Value="M 0 0 L 4 4 L 8 0 Z" />
                        </Trigger>
                     </ControlTemplate.Triggers>
                  </ControlTemplate>
               </ToggleButton.Template>
            </ToggleButton>
         </Grid>

         <Popup x:Name="PART_Popup"
                Placement="Bottom"
                IsOpen="{TemplateBinding IsDropDownOpen}"
                AllowsTransparency="True"
                Focusable="False"
                PopupAnimation="Slide">
            <Grid SnapsToDevicePixels="True"
                  MinWidth="{TemplateBinding ActualWidth}"
                  MaxHeight="{TemplateBinding MaxDropDownHeight}">
               <Border Background="White"
                       BorderBrush="Black"
                       BorderThickness="1"
                       TextElement.Foreground="Black">
                  <ScrollViewer CanContentScroll="True"
                                HorizontalScrollBarVisibility="Hidden"
                                VerticalScrollBarVisibility="Auto">
                     <!--<ItemsPresenter />-->
                     <VirtualizingStackPanel IsItemsHost="True" />
                  </ScrollViewer>
               </Border>
            </Grid>
         </Popup>
      </Grid>

      <ControlTemplate.Triggers>
         <Trigger Property="IsMouseOver"
                  Value="True">
            <Setter TargetName="outlineBorder"
                    Property="Opacity"
                    Value="1" />
            <Setter TargetName="innerBorder"
                    Property="Opacity"
                    Value="1" />
            <Setter TargetName="seperator"
                    Property="Visibility"
                    Value="Visible" />
         </Trigger>

         <Trigger Property="IsDropDownOpen"
                  Value="True">
            <Setter TargetName="outlineBorder"
                    Property="Opacity"
                    Value="1" />
            <Setter TargetName="innerBorder"
                    Property="Opacity"
                    Value="1" />
            <Setter TargetName="seperator"
                    Property="Visibility"
                    Value="Visible" />
         </Trigger>

         <Trigger Property="IsEnabled"
                  Value="False">
            <Setter Property="Opacity"
                    TargetName="outlineBorder"
                    Value="0" />
            <Setter Property="Opacity"
                    TargetName="innerBorder"
                    Value="0" />
         </Trigger>
      </ControlTemplate.Triggers>
   </ControlTemplate>

   <!--**************************
    * TEMPLATE: GroupNavigationButton
    ************************** -->
   <ControlTemplate x:Key="tableflowViewGroupNavigationButtonTemplate"
                    TargetType="{x:Type local:GroupNavigationButton}">
      <Grid>
         <Border x:Name="outerBorder"
                 BorderBrush="#FF03395B"
                 BorderThickness="1"
                 Background="#00FFFFFF"
                 CornerRadius="4"
                 Opacity="0" />
         <Border x:Name="innerBorder"
                 BorderBrush="#CC82B9D8"
                 BorderThickness="1"
                 CornerRadius="3"
                 Margin="1"
                 Opacity="0" />

         <ContentPresenter Margin="4,2,4,2" />
      </Grid>
      <ControlTemplate.Triggers>
         <Trigger Property="IsMouseOver"
                  Value="True">
            <Setter Property="Opacity"
                    TargetName="outerBorder"
                    Value="1" />
            <Setter Property="Opacity"
                    TargetName="innerBorder"
                    Value="1" />
         </Trigger>
         <Trigger Property="IsEnabled"
                  Value="False">
            <Setter Property="Opacity"
                    TargetName="outerBorder"
                    Value="0" />
            <Setter Property="Opacity"
                    TargetName="innerBorder"
                    Value="0" />
         </Trigger>
      </ControlTemplate.Triggers>
   </ControlTemplate>

   <!--**************************
    * TEMPLATE: RowSelector 
    ************************** -->
   <ControlTemplate x:Key="tableflowViewRowSelectorTemplate"
                    TargetType="local:RowSelector">

      <!-- This Grid is used to position the resizer Thumb over the RowSelector -->
      <Grid>

         <Border x:Name="rootBorder"
                 Background="{TemplateBinding Background}"
                 BorderBrush="{TemplateBinding BorderBrush}"
                 BorderThickness="{TemplateBinding BorderThickness}">

            <Grid>
               <Viewbox MaxHeight="16"
                        VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                        HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}">
                  <ContentPresenter x:Name="contentPresenter"
                                    Margin="{TemplateBinding Padding}"
                                    Content="{TemplateBinding Content}"
                                    ContentTemplate="{TemplateBinding ContentTemplate}"
                                    ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}" />
               </Viewbox>

               <!-- This is the two white lines we see at top and bottom of the RowSelector Item. More visible on MouseOver -->
               <Border BorderThickness="0,1,0,1"
                       Margin="0,1,0,0"
                       BorderBrush="{StaticResource rowSelectorDelimiterBorderBrush}"
                       Opacity="0.4" />

            </Grid>
         </Border>

         <!-- Thumb that is used to resize the Row. -->
         <Thumb x:Name="PART_RowResizerThumb"
                Style="{StaticResource invisibleThumbStyle}"
                VerticalAlignment="Bottom" />

      </Grid>

      <ControlTemplate.Triggers>

         <Trigger Property="IsMouseOver"
                  Value="True">

            <Setter TargetName="rootBorder"
                    Property="Background"
                    Value="{StaticResource rowSelectorHotBackgroundBrush}" />

         </Trigger>

         <Trigger Property="IsPressed"
                  Value="True">

            <Setter TargetName="rootBorder"
                    Property="Background"
                    Value="{StaticResource rowSelectorPressedBackgroundBrush}" />

         </Trigger>

      </ControlTemplate.Triggers>

   </ControlTemplate>

   <!--**************************
    * TEMPLATE: Row 
    ************************** -->
   <ControlTemplate x:Key="tableflowViewRowTemplate"
                    TargetType="local:Row">

      <ControlTemplate.Resources>
         <conv:TypeToBooleanConverter x:Key="typeToBooleanConverter" />
      </ControlTemplate.Resources>

      <!-- This Grid is used to layout the GroupLevelIndicatorPane placeholder and the CellsHost panel. -->
      <Grid x:Name="rootGrid">
         <Grid.ColumnDefinitions>
            <!-- HierarchicalGroupLevelIndicatorPane -->
            <ColumnDefinition Width="Auto" />
            <!-- GroupLevelIndicatorPane -->
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="Auto" />

            <!-- CellsHost panel -->
            <ColumnDefinition Width="*" />
         </Grid.ColumnDefinitions>

         <local:HierarchicalGroupLevelIndicatorPane views:TableView.CanScrollHorizontally="False"
                                                    Grid.Column="0" />

         <!-- GroupLevelIndicatorPane is a placeholder for individual GroupLevelIndicator elements that are added
                       whenever this Row is part of a group. -->
         <local:GroupLevelIndicatorPane x:Name="groupLevelIndicatorPane"
                                        views:TableView.CanScrollHorizontally="False"
                                        Grid.Column="1" />

         <Border x:Name="outerBackground"
                 Grid.Column="2"
                 Grid.ColumnSpan="2"
                 Background="{TemplateBinding Background}"
                 BorderBrush="{TemplateBinding BorderBrush}"
                 BorderThickness="{TemplateBinding BorderThickness}"
                 views:TableView.CanScrollHorizontally="False" />

         <Border x:Name="rowBorder"
                 Grid.Column="2"
                 Grid.ColumnSpan="2"
                 BorderThickness="1"
                 CornerRadius="3"
                 views:TableView.CanScrollHorizontally="False">
            <Border x:Name="innerBackground"
                    BorderThickness="1"
                    CornerRadius="2" />
         </Border>

         <!-- Button that is used to expand/collapse the group. -->
         <Button x:Name="detailsToggle"
                 Template="{StaticResource detailsExpanderButtonTemplate}"
                 VerticalAlignment="Top"
                 Grid.Column="2"
                 Margin="2"
                 Command="{x:Static local:DataGridCommands.ToggleDetailExpansion}"
                 OverridesDefaultStyle="True"
                 Focusable="False"
                 Visibility="Collapsed"
                 views:TableView.CanScrollHorizontally="False" />

         <!-- This TextBlock is used to ensure that the DesiredSize for 
         the Row will never fall below the Height of a String using the inherited font size and face-->
         <TextBlock Text=""
                    Visibility="Hidden"
                    Grid.Column="3"
                    Margin="{TemplateBinding BorderThickness}" />

         <!-- The PART_CellsHost part designates the Panel to which this Row's Cells should be added.-->
         <views:FixedCellPanel x:Name="PART_CellsHost"
                               Grid.Column="3"
                               ColumnStretchMinWidth="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).ColumnStretchMinWidth}"
                               ColumnStretchMode="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).ColumnStretchMode}"
                               FixedCellCount="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).FixedColumnCount, Mode=TwoWay}"
                               FixedColumnDropMarkPen="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).FixedColumnDropMarkPen}"
                               Margin="{TemplateBinding BorderThickness}" />

      </Grid>

      <ControlTemplate.Triggers>

         <!-- This trigger is used to display the Active Selection look -->
         <MultiDataTrigger>
            <MultiDataTrigger.Conditions>

               <Condition Binding="{Binding RelativeSource={RelativeSource Self},Path=IsSelected}"
                          Value="True" />

               <Condition Binding="{Binding RelativeSource={RelativeSource Self},Path=(local:DataGridControl.DataGridContext).DataGridControl.IsKeyboardFocusWithin}"
                          Value="True" />

            </MultiDataTrigger.Conditions>

            <Setter TargetName="rowBorder"
                    Property="BorderBrush"
                    Value="{StaticResource selectionRowBorderBrush}" />

            <Setter TargetName="outerBackground"
                    Property="Background"
                    Value="{StaticResource selectionOuterRowBackgroundBrush}" />

            <Setter TargetName="innerBackground"
                    Property="Background"
                    Value="{StaticResource selectionInnerRowBackgroundBrush}" />

            <Setter TargetName="rootGrid"
                    Property="TextElement.Foreground"
                    Value="{Binding RelativeSource={RelativeSource TemplatedParent},Path=SelectionForeground}" />

         </MultiDataTrigger>

         <!-- This trigger is used to display the Inactive Selection look -->
         <MultiDataTrigger>
            <MultiDataTrigger.Conditions>

               <Condition Binding="{Binding RelativeSource={RelativeSource Self},Path=IsSelected}"
                          Value="True" />

               <Condition Binding="{Binding RelativeSource={RelativeSource Self},Path=(local:DataGridControl.DataGridContext).DataGridControl.IsKeyboardFocusWithin}"
                          Value="False" />

               <Condition Binding="{Binding RelativeSource={RelativeSource Self},Path=(local:DataGridControl.DataGridContext).DataGridControl.HideSelection}"
                          Value="False" />

            </MultiDataTrigger.Conditions>

            <Setter TargetName="rowBorder"
                    Property="BorderBrush"
                    Value="{StaticResource inactiveSelectionRowBorderBrush}" />

            <Setter TargetName="outerBackground"
                    Property="Background"
                    Value="{StaticResource inactiveSelectionOuterRowBackgroundBrush}" />

            <Setter TargetName="innerBackground"
                    Property="Background"
                    Value="{StaticResource inactiveSelectionInnerRowBackgroundBrush}" />

            <Setter TargetName="rootGrid"
                    Property="TextElement.Foreground"
                    Value="{Binding RelativeSource={RelativeSource TemplatedParent},Path=InactiveSelectionForeground}" />

         </MultiDataTrigger>

         <!-- This trigger is used to display Mouse Over look -->
         <MultiDataTrigger>
            <MultiDataTrigger.Conditions>

               <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsMouseOver}"
                          Value="True" />

               <Condition Binding="{Binding RelativeSource={RelativeSource Self},Path=(local:DataGridControl.DataGridContext).DataGridControl.SelectionUnit}"
                          Value="Row" />

            </MultiDataTrigger.Conditions>

            <Setter TargetName="rowBorder"
                    Property="BorderBrush"
                    Value="{StaticResource hotRowBorderBrush}" />

            <Setter TargetName="outerBackground"
                    Property="Background"
                    Value="{StaticResource hotOuterRowBackgroundBrush}" />

            <Setter TargetName="innerBackground"
                    Property="Background"
                    Value="{StaticResource hotInnerRowBackgroundBrush}" />

         </MultiDataTrigger>

         <!-- This trigger is used to display Mouse Over + Selected look -->
         <MultiDataTrigger>
            <MultiDataTrigger.Conditions>

               <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsMouseOver}"
                          Value="True" />

               <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsSelected}"
                          Value="True" />

               <Condition Binding="{Binding RelativeSource={RelativeSource Self},Path=(local:DataGridControl.DataGridContext).DataGridControl.SelectionUnit}"
                          Value="Row" />

            </MultiDataTrigger.Conditions>

            <Setter TargetName="rowBorder"
                    Property="BorderBrush"
                    Value="{StaticResource hotSelectionRowBorderBrush}" />

            <Setter TargetName="outerBackground"
                    Property="Background"
                    Value="{StaticResource hotSelectionOuterRowBackgroundBrush}" />

            <Setter TargetName="innerBackground"
                    Property="Background"
                    Value="{StaticResource hotSelectionInnerRowBackgroundBrush}" />

         </MultiDataTrigger>

         <!-- When there are details, display the Toggle button for the expansion, collapsing of the details -->
         <MultiDataTrigger>
            <MultiDataTrigger.Conditions>
               <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).HasDetails}"
                          Value="True" />
               <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).AllowDetailToggle}"
                          Value="True" />
               <Condition Value="True"
                          Binding="{Binding RelativeSource={RelativeSource Self}, Path=., Mode=OneWay, Converter={StaticResource typeToBooleanConverter}, ConverterParameter={x:Type local:DataRow}}" />
            </MultiDataTrigger.Conditions>

            <Setter TargetName="detailsToggle"
                    Property="Visibility"
                    Value="Visible" />

         </MultiDataTrigger>

         <MultiDataTrigger>
            <MultiDataTrigger.Conditions>
               <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).HasDetails}"
                          Value="True" />
               <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).AllowDetailToggle}"
                          Value="True" />
               <Condition Value="False"
                          Binding="{Binding RelativeSource={RelativeSource Self}, Path=., Mode=OneWay, Converter={StaticResource typeToBooleanConverter}, ConverterParameter={x:Type local:DataRow}}" />
            </MultiDataTrigger.Conditions>

            <Setter TargetName="detailsToggle"
                    Property="Visibility"
                    Value="Hidden" />

         </MultiDataTrigger>

      </ControlTemplate.Triggers>

   </ControlTemplate>

   <!--**************************
    * TEMPLATE: ColumnManagerRow 
    ************************** -->
   <ControlTemplate x:Key="tableflowViewColumnManagerRowTemplate"
                    TargetType="local:ColumnManagerRow">

      <ControlTemplate.Resources>
         <conv:ThicknessConverter x:Key="thicknessConverter"
                                  InverseValue="True" />
      </ControlTemplate.Resources>

      <!-- This Grid is used to layout the GroupLevelIndicatorPane placeholder and the CellsHost panel. -->
      <Grid x:Name="rootGrid">
         <Grid.ColumnDefinitions>
            <!-- HierarchicalGroupLevelIndicatorPane -->
            <ColumnDefinition Width="Auto" />
            <!-- GroupLevelIndicatorPane -->
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="Auto" />

            <!-- CellsHost panel -->
            <ColumnDefinition Width="*" />
         </Grid.ColumnDefinitions>

         <!-- The border responsible for the visual outline of the row (gridlines and background)
              spans the GroupLevelIndicatorPane and CellsHost Panel. Those 2 elements are not children of
              the Border because we don't want the border to be displayed in the GroupLevelIndicatorPane. -->
         <Border x:Name="rootBorder"
                 Grid.Column="1"
                 Grid.ColumnSpan="3"
                 views:TableView.CanScrollHorizontally="False"
                 Background="{TemplateBinding Background}"
                 BorderBrush="{TemplateBinding BorderBrush}"
                 BorderThickness="{TemplateBinding BorderThickness}"
                 Padding="{TemplateBinding Padding}" />

         <!-- GroupLevelIndicatorPane is a placeholder for individual GroupLevelIndicator elements that are added
                       whenever this Row is part of a group. -->
         <local:HierarchicalGroupLevelIndicatorPane Grid.Column="0"
                                                    views:TableView.CanScrollHorizontally="False"
                                                    Background="{TemplateBinding Background}" />
         <local:GroupLevelIndicatorPane x:Name="groupLevelIndicatorPane"
                                        Grid.Column="1"
                                        views:TableView.CanScrollHorizontally="False"
                                        Background="{TemplateBinding Background}" />

         <!-- Button that is used to expand/collapse the group. -->
         <Button x:Name="detailsToggle"
                 Template="{StaticResource detailsExpanderButtonTemplate}"
                 VerticalAlignment="Top"
                 Grid.Column="2"
                 Margin="2,4,2,0"
                 Command="{x:Static local:DataGridCommands.ToggleDetailExpansion}"
                 OverridesDefaultStyle="True"
                 Focusable="False"
                 Visibility="Collapsed"
                 views:TableView.CanScrollHorizontally="False" />

         <!-- The PART_CellsHost part designates the Panel to which this Row's Cells should be added.-->
         <Decorator x:Name="indentationDecorator"
                    Grid.Column="3">
            <views:FixedCellPanel x:Name="PART_CellsHost"
                                  ColumnStretchMinWidth="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).ColumnStretchMinWidth}"
                                  ColumnStretchMode="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).ColumnStretchMode}"
                                  FixedCellCount="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).FixedColumnCount, Mode=TwoWay}"
                                  FixedColumnDropMarkPen="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).FixedColumnDropMarkPen}"
                                  Margin="{TemplateBinding BorderThickness}" />
         </Decorator>

      </Grid>
      <ControlTemplate.Triggers>
         <!-- When there are details, display the Toggle button for the expansion, collapsing of the details -->
         <MultiDataTrigger>
            <MultiDataTrigger.Conditions>
               <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).HasDetails}"
                          Value="True" />

               <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).AllowDetailToggle}"
                          Value="True" />

            </MultiDataTrigger.Conditions>

            <Setter TargetName="detailsToggle"
                    Property="Visibility"
                    Value="Hidden" />

         </MultiDataTrigger>

      </ControlTemplate.Triggers>

   </ControlTemplate>

   <!--**************************
    * TEMPLATE: Cell 
    ************************** -->
   <ControlTemplate x:Key="tableflowViewCellTemplate"
                    TargetType="local:Cell">

      <Grid>

         <Border x:Name="rootBorder"
                 Background="{TemplateBinding Background}"
                 BorderBrush="{TemplateBinding BorderBrush}"
                 BorderThickness="{TemplateBinding BorderThickness}">
            <Grid>
               <Border x:Name="cellBorder"
                       BorderThickness="1"
                       CornerRadius="3"
                       Visibility="Collapsed">
                  <Border x:Name="innerBackground"
                          BorderThickness="1"
                          CornerRadius="2">

                  </Border>
               </Border>

               <local:CellContentPresenter x:Name="PART_CellContentPresenter"
                                           HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                           VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                           Margin="{TemplateBinding Padding}" />
            </Grid>
         </Border>

         <Border x:Name="currentBorder"
                 BorderBrush="Transparent"
                 BorderThickness="1" />

      </Grid>

      <ControlTemplate.Triggers>

         <!-- When changing the appearance (e.g., background/foreground) of the Cell to reflect specific
              states (e.g., IsCurrent), it is recommended to apply the changes directly to the template
              elements because we want those modifications to be effective even when a value has been
              explicitly set to these properties on the TemplatedParent. Also, when someone queries
              the value of these properties on the TemplatedParent, we don't want to return the
              intermediate, state-specific values. -->

         <!-- When the Cell is Current, we want to change its background/foreground to the appropriate brushes.
              We do this only when the cell does not have a validation error because we must give priority
              to the CellErrorStyle (if present).-->

         <MultiTrigger>
            <MultiTrigger.Conditions>

               <Condition Property="IsCurrent"
                          Value="True" />

               <Condition Property="HasValidationError"
                          Value="False" />

            </MultiTrigger.Conditions>

            <Setter TargetName="rootBorder"
                    Property="Background"
                    Value="{Binding RelativeSource={RelativeSource TemplatedParent},Path=CurrentBackground}" />

            <Setter TargetName="rootBorder"
                    Property="TextElement.Foreground"
                    Value="{Binding RelativeSource={RelativeSource TemplatedParent},Path=CurrentForeground}" />

         </MultiTrigger>

         <MultiTrigger>
            <MultiTrigger.Conditions>

               <Condition Property="IsCurrent"
                          Value="True" />

               <Condition Property="HasValidationError"
                          Value="True" />

               <Condition Property="CellErrorStyle"
                          Value="{x:Null}" />

            </MultiTrigger.Conditions>

            <Setter TargetName="rootBorder"
                    Property="Background"
                    Value="{Binding RelativeSource={RelativeSource TemplatedParent},Path=CurrentBackground}" />

            <Setter TargetName="rootBorder"
                    Property="TextElement.Foreground"
                    Value="{Binding RelativeSource={RelativeSource TemplatedParent},Path=CurrentForeground}" />

         </MultiTrigger>

         <MultiDataTrigger>
            <MultiDataTrigger.Conditions>

               <Condition Binding="{Binding RelativeSource={RelativeSource Self},Path=IsCurrent}"
                          Value="True" />

               <Condition Binding="{Binding RelativeSource={RelativeSource Self},Path=(local:DataGridControl.DataGridContext).(local:DataGridContext.DataGridControl).IsKeyboardFocusWithin}"
                          Value="True" />

            </MultiDataTrigger.Conditions>

            <Setter TargetName="currentBorder"
                    Property="BorderBrush"
                    Value="{StaticResource selectionRowBorderBrush}" />

         </MultiDataTrigger>

         <!-- When the Row is Selected but the parent DataGridControl is not focused, we want to change
              the Row's background/foreground to the appropriate brushes. -->
         <MultiDataTrigger>
            <MultiDataTrigger.Conditions>

               <Condition Binding="{Binding RelativeSource={RelativeSource Self},Path=IsCurrent}"
                          Value="True" />

               <Condition Binding="{Binding RelativeSource={RelativeSource Self},Path=(local:DataGridControl.DataGridContext).(local:DataGridContext.DataGridControl).IsKeyboardFocusWithin}"
                          Value="False" />

               <Condition Binding="{Binding RelativeSource={RelativeSource Self},Path=(local:DataGridControl.DataGridContext).(local:DataGridContext.DataGridControl).HideSelection}"
                          Value="False" />

            </MultiDataTrigger.Conditions>

            <Setter TargetName="currentBorder"
                    Property="BorderBrush"
                    Value="{StaticResource inactiveSelectionRowBorderBrush}" />

         </MultiDataTrigger>

         <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self},Path=(local:DataGridControl.DataGridContext).(local:DataGridContext.DataGridControl).SelectionUnit}"
                      Value="Cell">

            <Setter TargetName="cellBorder"
                    Property="Visibility"
                    Value="Visible" />

            <Setter TargetName="currentBorder"
                    Property="Visibility"
                    Value="Collapsed" />

         </DataTrigger>

         <!-- This trigger is used to display Mouse Over look -->
         <MultiDataTrigger>
            <MultiDataTrigger.Conditions>

               <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsMouseOver}"
                          Value="True" />

               <Condition Binding="{Binding RelativeSource={RelativeSource Self},Path=(local:DataGridControl.DataGridContext).(local:DataGridContext.DataGridControl).SelectionUnit}"
                          Value="Cell" />

            </MultiDataTrigger.Conditions>

            <Setter TargetName="cellBorder"
                    Property="BorderBrush"
                    Value="{StaticResource hotRowBorderBrush}" />

            <Setter TargetName="rootBorder"
                    Property="Background"
                    Value="{StaticResource hotOuterRowBackgroundBrush}" />

            <Setter TargetName="innerBackground"
                    Property="Background"
                    Value="{StaticResource hotInnerRowBackgroundBrush}" />

         </MultiDataTrigger>

         <!-- This trigger is used to display Mouse Over + Selected look -->
         <MultiDataTrigger>
            <MultiDataTrigger.Conditions>

               <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsMouseOver}"
                          Value="True" />

               <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsSelected}"
                          Value="True" />

               <Condition Binding="{Binding RelativeSource={RelativeSource Self},Path=(local:DataGridControl.DataGridContext).(local:DataGridContext.DataGridControl).SelectionUnit}"
                          Value="Cell" />

            </MultiDataTrigger.Conditions>

            <Setter TargetName="cellBorder"
                    Property="BorderBrush"
                    Value="{StaticResource hotSelectionRowBorderBrush}" />

            <Setter TargetName="rootBorder"
                    Property="Background"
                    Value="{StaticResource hotSelectionOuterRowBackgroundBrush}" />

            <Setter TargetName="innerBackground"
                    Property="Background"
                    Value="{StaticResource hotSelectionInnerRowBackgroundBrush}" />

         </MultiDataTrigger>

         <!-- When the Cell is Selected, we want to change its background/foreground to the appropriate brushes. -->
         <MultiDataTrigger>
            <MultiDataTrigger.Conditions>

               <Condition Binding="{Binding RelativeSource={RelativeSource Self},Path=IsSelected}"
                          Value="True" />

               <Condition Binding="{Binding RelativeSource={RelativeSource Self},Path=(local:DataGridControl.DataGridContext).(local:DataGridContext.DataGridControl).IsKeyboardFocusWithin}"
                          Value="True" />

            </MultiDataTrigger.Conditions>

            <Setter TargetName="rootBorder"
                    Property="Background"
                    Value="{StaticResource selectionOuterRowBackgroundBrush}" />

            <Setter TargetName="cellBorder"
                    Property="BorderBrush"
                    Value="{StaticResource selectionRowBorderBrush}" />

            <Setter TargetName="innerBackground"
                    Property="Background"
                    Value="{Binding RelativeSource={RelativeSource TemplatedParent},Path=SelectionBackground}" />

            <Setter TargetName="rootBorder"
                    Property="TextElement.Foreground"
                    Value="{Binding RelativeSource={RelativeSource TemplatedParent},Path=SelectionForeground}" />

         </MultiDataTrigger>

         <!-- When the Cell is Selected but the parent DataGridControl is not focused, we want to change
              the Cell's background/foreground to the appropriate brushes. -->
         <MultiDataTrigger>
            <MultiDataTrigger.Conditions>

               <Condition Binding="{Binding RelativeSource={RelativeSource Self},Path=IsSelected}"
                          Value="True" />

               <Condition Binding="{Binding RelativeSource={RelativeSource Self},Path=(local:DataGridControl.DataGridContext).(local:DataGridContext.DataGridControl).IsKeyboardFocusWithin}"
                          Value="False" />

               <Condition Binding="{Binding RelativeSource={RelativeSource Self},Path=(local:DataGridControl.DataGridContext).(local:DataGridContext.DataGridControl).HideSelection}"
                          Value="False" />

            </MultiDataTrigger.Conditions>

            <Setter TargetName="rootBorder"
                    Property="Background"
                    Value="{StaticResource inactiveSelectionOuterRowBackgroundBrush}" />

            <Setter TargetName="cellBorder"
                    Property="BorderBrush"
                    Value="{StaticResource inactiveSelectionRowBorderBrush}" />

            <Setter TargetName="innerBackground"
                    Property="Background"
                    Value="{Binding RelativeSource={RelativeSource TemplatedParent},Path=InactiveSelectionBackground}" />

            <Setter TargetName="rootBorder"
                    Property="TextElement.Foreground"
                    Value="{Binding RelativeSource={RelativeSource TemplatedParent},Path=InactiveSelectionForeground}" />

         </MultiDataTrigger>

         <!-- When the Cell's content is Null and the row is not being edited, we want to ensure that the row/cell
              will preserve a minimum height based on the current font size for the row/cell. To do this, we override
              the ContentPresenter's content binding and replace it with an empty string (""), the textbox generated 
              this way will then size to the default text's height. When the trigger is not active anymore, default binding
              is restored automatically. -->

         <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=ParentColumn.Visible}"
                      Value="False">
            <Setter Property="Visibility"
                    Value="Collapsed" />
         </DataTrigger>

      </ControlTemplate.Triggers>

   </ControlTemplate>

   <!--**************************
    * TEMPLATE: ColumnManagerCell 
    ************************** -->
    <conv:SortingDirectionToBooleanConverter x:Key="SortingDirectionToBooleanConverter" />

   <ControlTemplate x:Key="tableflowViewColumnManagerCellTemplate"
                    TargetType="local:ColumnManagerCell">

      <!-- This Grid is used to position the resizer Thumb over the ColumnManagerCell -->
      <Grid>

         <Border x:Name="rootBorder"
                 Background="{TemplateBinding Background}"
                 BorderBrush="{TemplateBinding BorderBrush}"
                 BorderThickness="{TemplateBinding BorderThickness}">

            <DockPanel>

               <Grid>

                  <DockPanel Margin="{TemplateBinding Padding}">

                     <StackPanel Orientation="Horizontal"
                                 DockPanel.Dock="Top"
                                 HorizontalAlignment="Center">
                        <ContentPresenter x:Name="sortGlyphPresenter"
                                          Content="{x:Null}"
                                          ContentTemplate="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).AscendingSortGlyph}"
                                          VerticalAlignment="Top"
                                          Visibility="Hidden" />
                     </StackPanel>
                     <Grid>
                        <Grid.ColumnDefinitions>
                           <ColumnDefinition Width="*" />
                           <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>
                        <local:CellContentPresenter x:Name="PART_CellContentPresenter"
                                                    HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                                    VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />

                        <Border x:Name="thumbToggleBackgroundBorder"
                                Grid.Column="1"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="0"
                                Background="{StaticResource horizontalHeaderBackgroundBrush}">

                           <ToggleButton x:Name="toggleButton"
                                         Focusable="False"
                                         VerticalAlignment="Stretch"
                                         Visibility="Collapsed"
                                         Margin="2,0,0,0"
                                         Opacity="0.5" />

                        </Border>
                     </Grid>

                  </DockPanel>

                  <Border x:Name="delimiterBorder"
                          BorderThickness="1,0,1,0"
                          BorderBrush="{StaticResource rowSelectorDelimiterBorderBrush}" />
               </Grid>

            </DockPanel>

         </Border>

         <!-- Thumb that is used to resize the Column. -->
         <Thumb x:Name="PART_ColumnResizerThumbLeft"
                Style="{StaticResource invisibleThumbStyle}"
                HorizontalAlignment="Left" />

         <!-- Thumb that is used to resize the Column. -->
         <Thumb x:Name="PART_ColumnResizerThumb"
                Style="{StaticResource invisibleThumbStyle}"
                HorizontalAlignment="Right" />

      </Grid>

      <ControlTemplate.Triggers>

         <!-- The following triggers allows the content to correctly align to the center when the mouse is over the ColumnManagerCell and the HorizontalContentAlignment is Center -->
         <MultiDataTrigger>
            <MultiDataTrigger.Conditions>
               <Condition Value="Visible"
                          Binding="{Binding ElementName=toggleButton, Path=Visibility}" />
               <Condition Value="Center"
                          Binding="{Binding RelativeSource={RelativeSource Self},
                        Path=HorizontalContentAlignment}" />
            </MultiDataTrigger.Conditions>

            <Setter TargetName="PART_CellContentPresenter"
                    Property="Margin"
                    Value="19,0,0,0" />
         </MultiDataTrigger>

         <!-- Trigger related to the filteringToggleButton-->
         <Trigger SourceName="toggleButton"
                  Property="IsMouseOver"
                  Value="True">

            <Setter TargetName="toggleButton"
                    Property="Opacity"
                    Value="1" />
         </Trigger>

         <!-- The following 2 triggers allow the appropriate Sort Glyph to be displayed
              depending on the ParentColumn's SortDirection. -->

         <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=ParentColumn.SortDirection}"
                      Value="Ascending">

            <Setter TargetName="sortGlyphPresenter"
                    Property="Visibility"
                    Value="Visible" />

            <Setter TargetName="rootBorder"
                    Property="BorderBrush"
                    Value="{StaticResource columnManagerCellHotBorderBrush}" />

            <Setter TargetName="rootBorder"
                    Property="Background"
                    Value="{StaticResource columnManagerCellHotBackgroundBrush}" />

            <Setter TargetName="thumbToggleBackgroundBorder"
                    Property="Background"
                    Value="{StaticResource columnManagerCellHotBackgroundBrush}" />

            <Setter TargetName="delimiterBorder"
                    Property="Visibility"
                    Value="Hidden" />

         </DataTrigger>

         <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=ParentColumn.SortDirection}"
                      Value="Descending">

            <Setter TargetName="sortGlyphPresenter"
                    Property="ContentPresenter.ContentTemplate"
                    Value="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).DescendingSortGlyph}" />

            <Setter TargetName="sortGlyphPresenter"
                    Property="Visibility"
                    Value="Visible" />

            <Setter TargetName="rootBorder"
                    Property="BorderBrush"
                    Value="{StaticResource columnManagerCellHotBorderBrush}" />

            <Setter TargetName="rootBorder"
                    Property="Background"
                    Value="{StaticResource columnManagerCellHotBackgroundBrush}" />

            <Setter TargetName="thumbToggleBackgroundBorder"
                    Property="Background"
                    Value="{StaticResource columnManagerCellHotBackgroundBrush}" />

            <Setter TargetName="delimiterBorder"
                    Property="Visibility"
                    Value="Hidden" />

         </DataTrigger>

         <Trigger Property="IsMouseOver"
                  Value="True">

            <Setter TargetName="rootBorder"
                    Property="BorderBrush"
                    Value="{StaticResource columnManagerCellHotBorderBrush}" />

            <Setter TargetName="rootBorder"
                    Property="Background"
                    Value="{StaticResource columnManagerCellHotBackgroundBrush}" />

            <Setter TargetName="delimiterBorder"
                    Property="Visibility"
                    Value="Hidden" />

            <Setter TargetName="thumbToggleBackgroundBorder"
                    Property="Background"
                    Value="{StaticResource columnManagerCellHotBackgroundBrush}" />

         </Trigger>

         <Trigger Property="IsPressed"
                  Value="True">

            <Setter TargetName="rootBorder"
                    Property="BorderBrush"
                    Value="{StaticResource columnManagerCellPressedBorderBrush}" />

            <Setter TargetName="rootBorder"
                    Property="Background"
                    Value="{StaticResource columnManagerCellPressedBackgroundBrush}" />

            <Setter TargetName="thumbToggleBackgroundBorder"
                    Property="Background"
                    Value="{StaticResource columnManagerCellPressedBackgroundBrush}" />

            <Setter TargetName="delimiterBorder"
                    Property="Visibility"
                    Value="Hidden" />

         </Trigger>

         <MultiDataTrigger>
            <MultiDataTrigger.Conditions>
               <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=ParentColumn.HasFixedWidth}"
                          Value="True" />

               <!-- Don't disable resizing if ColumnStretching can be disabled by an 
                    end-user resize. -->
               <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).RemoveColumnStretchingOnResize}"
                          Value="False" />
            </MultiDataTrigger.Conditions>

            <Setter TargetName="PART_ColumnResizerThumb"
                    Property="IsEnabled"
                    Value="False" />
         </MultiDataTrigger>

         <MultiDataTrigger>
            <MultiDataTrigger.Conditions>
               <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=ParentColumn.PreviousVisibleColumn.HasFixedWidth}"
                          Value="True" />

               <!-- Don't disable resizing if ColumnStretching can be disabled by an 
                    end-user resize. -->
               <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).RemoveColumnStretchingOnResize}"
                          Value="False" />
            </MultiDataTrigger.Conditions>

            <Setter TargetName="PART_ColumnResizerThumbLeft"
                    Property="IsEnabled"
                    Value="False" />
         </MultiDataTrigger>

         <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=ParentRow.AllowColumnResize}"
                      Value="False">
            <Setter TargetName="PART_ColumnResizerThumb"
                    Property="IsEnabled"
                    Value="False" />
            <Setter TargetName="PART_ColumnResizerThumbLeft"
                    Property="IsEnabled"
                    Value="False" />
         </DataTrigger>

         <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=ParentColumn.Visible}"
                      Value="False">
            <Setter Property="Visibility"
                    Value="Collapsed" />
         </DataTrigger>

      </ControlTemplate.Triggers>

   </ControlTemplate>

   <!--**************************
    * TEMPLATE: GroupHeaderControl
    ************************** -->
   <conv:IntAdditionConverter x:Key="groupHeaderControlGroupLevelConverter" />
   <ControlTemplate x:Key="tableflowViewGroupHeaderControlTemplate"
                    TargetType="local:GroupHeaderControl">

      <!-- Using this decorator will prevent the GroupHeaderControl of exceeding the width 
           defined by the grid's column. -->
      <views:PassiveLayoutDecorator Axis="Horizontal">
         <!-- This DockPanel is used to layout the GroupLevelIndicatorPane placeholder and the GroupHeaderControl Content. -->
         <DockPanel>

            <!-- GroupLevelIndicatorPane is a placeholder for individual GroupLevelIndicator elements that are added
              whenever this GroupHeaderControl is part of a group. -->
            <local:HierarchicalGroupLevelIndicatorPane DockPanel.Dock="Left" />
            <local:GroupLevelIndicatorPane DockPanel.Dock="Left"
                                           Indented="False"
                                           local:GroupLevelIndicatorPane.GroupLevel="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(local:GroupLevelIndicatorPane.GroupLevel), Converter={StaticResource groupHeaderControlGroupLevelConverter}, ConverterParameter=-1}" />
            <!-- Main Border for the GroupHeaderControl. It is Focusable to make the InputBindings work. -->
            <Border x:Name="mainBorder"
                    Background="{TemplateBinding Background}"
                    BorderBrush="{TemplateBinding BorderBrush}"
                    BorderThickness="{TemplateBinding BorderThickness}"
                    Padding="{TemplateBinding Padding}"
                    Focusable="True"
                    FocusVisualStyle="{TemplateBinding FocusVisualStyle}">

               <!-- Define all the standard InputBindings for a GroupHeaderControl. -->
               <Border.InputBindings>
                  <KeyBinding Command="{x:Static local:DataGridCommands.ToggleGroupExpansion}"
                              Key="Space" />

                  <KeyBinding Command="{x:Static local:DataGridCommands.ExpandGroup}"
                              Key="Right" />

                  <KeyBinding Command="{x:Static local:DataGridCommands.ExpandGroup}"
                              Key="Add" />

                  <KeyBinding Command="{x:Static local:DataGridCommands.CollapseGroup}"
                              Key="Left" />

                  <KeyBinding Command="{x:Static local:DataGridCommands.CollapseGroup}"
                              Key="Subtract" />

                  <MouseBinding Command="{x:Static local:DataGridCommands.ToggleGroupExpansion}"
                                MouseAction="LeftDoubleClick" />

               </Border.InputBindings>

               <DockPanel>

                  <!-- ToggleButton that is used to expand/collapse the group. -->
                  <ToggleButton DockPanel.Dock="Left"
                                OverridesDefaultStyle="True"
                                Template="{StaticResource groupExpanderToggleButtonTemplate}"
                                VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                Focusable="False"
                                IsChecked="{Binding RelativeSource={RelativeSource TemplatedParent},Path=Group.IsExpanded}" />

                  <!-- ContentPresenter in charge of displaying this GroupHeaderControl's Content, which is
                    a Group by default. -->
                  <ContentPresenter DockPanel.Dock="Left"
                                    Margin="3,0,0,0"
                                    Content="{TemplateBinding Content}"
                                    ContentTemplate="{TemplateBinding ContentTemplate}"
                                    ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}"
                                    VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />

                  <!-- Blue line that is traced across the GroupHeader, following the content -->
                  <Rectangle Fill="#B0BFDE"
                             VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                             HorizontalAlignment="Stretch"
                             Height="1"
                             Margin="7,0,0,0" />
               </DockPanel>
            </Border>
         </DockPanel>
      </views:PassiveLayoutDecorator>

      <ControlTemplate.Triggers>
         <Trigger Property="local:DataGridControl.NavigationBehavior"
                  Value="None">
            <Setter TargetName="mainBorder"
                    Property="Focusable"
                    Value="False" />
         </Trigger>
      </ControlTemplate.Triggers>

   </ControlTemplate>

   <!--**************************
    * TEMPLATE: GroupHeaderControl (When top level sticky)
    ************************** -->
   <ControlTemplate x:Key="tableflowViewGroupHeaderTopLevelStickyControlTemplate"
                    TargetType="local:GroupHeaderControl">

      <!-- Using this decorator will prevent the GroupHeaderControl of exceeding the width 
           defined by the grid's column. -->
      <views:PassiveLayoutDecorator Axis="Horizontal">
         <!-- This DockPanel is used to layout the GroupLevelIndicatorPane placeholder and the GroupHeaderControl Content. -->
         <DockPanel>

            <!-- GroupLevelIndicatorPane is a placeholder for individual GroupLevelIndicator elements that are added
              whenever this GroupHeaderControl is part of a group. -->
            <local:HierarchicalGroupLevelIndicatorPane DockPanel.Dock="Left" />
            <local:GroupLevelIndicatorPane DockPanel.Dock="Left"
                                           Indented="False"
                                           local:GroupLevelIndicatorPane.GroupLevel="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(local:GroupLevelIndicatorPane.GroupLevel), Converter={StaticResource groupHeaderControlGroupLevelConverter}, ConverterParameter=-1}" />

            <Grid>
               <Border x:Name="outerBorder"
                       BorderBrush="#FF03395B"
                       BorderThickness="0,1,0,1">
                  <Grid>
                     <Grid.RowDefinitions>
                        <RowDefinition Height="0.5*" />
                        <RowDefinition Height="0.5*" />
                     </Grid.RowDefinitions>
                     <Border Grid.RowSpan="2">
                        <Border.Background>
                           <LinearGradientBrush EndPoint="0,0.5"
                                                StartPoint="1,0.5">
                              <GradientStop Color="#FF196C77"
                                            Offset="0" />
                              <GradientStop Color="#FF065F99"
                                            Offset="1" />
                           </LinearGradientBrush>
                        </Border.Background>
                     </Border>
                     <Border Opacity="0.2"
                             Grid.RowSpan="2">
                        <Border.Background>
                           <LinearGradientBrush EndPoint="0.5,0.5"
                                                StartPoint="0.5,0">
                              <GradientStop Color="#CCFFFFFF"
                                            Offset="1" />
                              <GradientStop Color="#4CFFFFFF"
                                            Offset="1" />
                           </LinearGradientBrush>
                        </Border.Background>
                     </Border>
                  </Grid>
               </Border>

               <!-- Main Border for the GroupHeaderControl. It is Focusable to make the InputBindings work. -->
               <Border x:Name="mainBorder"
                       Background="Transparent"
                       BorderBrush="{TemplateBinding BorderBrush}"
                       BorderThickness="{TemplateBinding BorderThickness}"
                       Padding="{TemplateBinding Padding}"
                       Focusable="True"
                       FocusVisualStyle="{TemplateBinding FocusVisualStyle}">

                  <!-- Define all the standard InputBindings for a GroupHeaderControl. -->
                  <Border.InputBindings>
                     <KeyBinding Command="{x:Static local:DataGridCommands.ToggleGroupExpansion}"
                                 Key="Space" />

                     <KeyBinding Command="{x:Static local:DataGridCommands.ExpandGroup}"
                                 Key="Right" />

                     <KeyBinding Command="{x:Static local:DataGridCommands.ExpandGroup}"
                                 Key="Add" />

                     <KeyBinding Command="{x:Static local:DataGridCommands.CollapseGroup}"
                                 Key="Left" />

                     <KeyBinding Command="{x:Static local:DataGridCommands.CollapseGroup}"
                                 Key="Subtract" />

                     <MouseBinding Command="{x:Static local:DataGridCommands.ToggleGroupExpansion}"
                                   MouseAction="LeftDoubleClick" />

                  </Border.InputBindings>

                  <DockPanel>

                     <!-- ToggleButton that is used to expand/collapse the group. -->
                     <ToggleButton DockPanel.Dock="Left"
                                   OverridesDefaultStyle="True"
                                   Template="{StaticResource groupExpanderToggleButtonTemplate}"
                                   VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                   Focusable="False"
                                   IsChecked="{Binding RelativeSource={RelativeSource TemplatedParent},Path=Group.IsExpanded}" />

                     <!-- ContentPresenter in charge of displaying this GroupHeaderControl's Content, which is
                    a Group by default. -->
                     <ContentPresenter DockPanel.Dock="Left"
                                       Margin="3,0,0,0"
                                       TextElement.Foreground="{TemplateBinding Foreground}"
                                       Content="{TemplateBinding Content}"
                                       ContentTemplate="{TemplateBinding ContentTemplate}"
                                       ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}"
                                       VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
                  </DockPanel>
               </Border>
            </Grid>
         </DockPanel>
      </views:PassiveLayoutDecorator>

      <ControlTemplate.Triggers>
         <Trigger Property="local:DataGridControl.NavigationBehavior"
                  Value="None">
            <Setter TargetName="mainBorder"
                    Property="Focusable"
                    Value="False" />
         </Trigger>
      </ControlTemplate.Triggers>

   </ControlTemplate>

   <!--**************************
    * TEMPLATE: HierarchicalGroupByControl
    ************************** -->

   <!-- TreeViewItem Style to avoid displaying Expander and avoid selection and click -->
   <Style x:Key="hierarchicalGroupByControlTreeViewItemStyle"
          TargetType="{x:Type TreeViewItem}">
      <Style.Resources>
         <conv:TreeViewLineConverter x:Key="LineConverter" />
      </Style.Resources>

      <Setter Property="IsExpanded"
              Value="True" />

      <Setter Property="Focusable"
              Value="False" />

      <Setter Property="Visibility">
         <Setter.Value>
            <PriorityBinding>
               <Binding Path="."
                        Converter="{StaticResource notDetailConfigConverter}"
                        ConverterParameter="{x:Type local:DetailConfiguration}" />
               <Binding Path="Visible"
                        Converter="{StaticResource booleanToVisibilityConverter}" />
            </PriorityBinding>

         </Setter.Value>
      </Setter>

      <Setter Property="Template">
         <Setter.Value>
            <ControlTemplate TargetType="{x:Type TreeViewItem}">
               <Grid ShowGridLines="False">
                  <Grid.ColumnDefinitions>

                     <!--This ColumnDefinition is required for stair spacing-->
                     <ColumnDefinition Width="20" />
                     <ColumnDefinition Width="Auto" />
                     <ColumnDefinition Width="*" />
                  </Grid.ColumnDefinitions>
                  <Grid.RowDefinitions>
                     <RowDefinition Height="*" />
                     <RowDefinition MaxHeight="1" />
                     <RowDefinition Height="*" />
                     <RowDefinition Height="Auto" />
                  </Grid.RowDefinitions>

                  <Border BorderThickness="{TemplateBinding Border.BorderThickness}"
                          Padding="{TemplateBinding Control.Padding}"
                          BorderBrush="{TemplateBinding Border.BorderBrush}"
                          Background="{TemplateBinding Panel.Background}"
                          Name="treeViewItemBorder"
                          SnapsToDevicePixels="True"
                          VerticalAlignment="Center"
                          Grid.Column="1"
                          Grid.RowSpan="3">

                     <!--Will contain DetailGroupByConrol-->

                     <ContentPresenter Content="{TemplateBinding HeaderedContentControl.Header}"
                                       ContentTemplate="{TemplateBinding HeaderedContentControl.HeaderTemplate}"
                                       ContentSource="Header"
                                       Name="PART_Header"
                                       HorizontalAlignment="{TemplateBinding Control.HorizontalContentAlignment}"
                                       SnapsToDevicePixels="{TemplateBinding UIElement.SnapsToDevicePixels}"
                                       Margin="2,0,2,0" />
                  </Border>

                  <ItemsPresenter Name="ItemsHost"
                                  Grid.Column="1"
                                  Grid.Row="3"
                                  Grid.ColumnSpan="2" />
               </Grid>
               <ControlTemplate.Triggers>
                  <Trigger Property="IsExpanded"
                           Value="false">
                     <Setter TargetName="ItemsHost"
                             Property="Visibility"
                             Value="Collapsed" />
                  </Trigger>
               </ControlTemplate.Triggers>
            </ControlTemplate>
         </Setter.Value>
      </Setter>
   </Style>

   <ControlTemplate x:Key="tableflowViewAeroNormalColorHierarchicalGroupByControlTemplate"
                    TargetType="local:HierarchicalGroupByControl">
      <ControlTemplate.Resources>
         <!--this style is set to avoid having implicit treeview style
             overide the HierarchicalGroupByControl's TreeView-->
         <Style TargetType="TreeView" />
      </ControlTemplate.Resources>

      <!-- This Grid is used to layout the GroupLevelIndicatorPane placeholder and the HierarchicalGroupByControl -->
      <Grid x:Name="rootGrid">
         <Grid.ColumnDefinitions>
            <!-- HierarchicalGroupLevelIndicatorPane -->
            <ColumnDefinition Width="Auto" />
            <!-- GroupLevelIndicatorPane -->
            <ColumnDefinition Width="Auto" />

            <!-- HierarchicalGroupByControl -->
            <ColumnDefinition Width="*" />
         </Grid.ColumnDefinitions>

         <!-- The border responsible for the visual outline of the row (gridlines and background)
              spans the GroupLevelIndicatorPane and CellsHost Panel. Those 2 elements are not children of
              the Border because we don't want the border to be displayed in the GroupLevelIndicatorPane. -->
         <Border x:Name="rootBorder"
                 Grid.Column="1"
                 Grid.ColumnSpan="2"
                 Background="{TemplateBinding Background}"
                 BorderBrush="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).HorizontalGridLineBrush}"
                 BorderThickness="{Binding RelativeSource={RelativeSource Self},Path=(local:DataGridControl.DataGridContext).HorizontalGridLineThickness,Converter={StaticResource thicknessConverter},ConverterParameter='Top'}"
                 Padding="{TemplateBinding Padding}" />

         <Border x:Name="verticalGridLineBorder"
                 Grid.Column="1"
                 Grid.ColumnSpan="2"
                 BorderBrush="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).VerticalGridLineBrush}"
                 BorderThickness="{Binding RelativeSource={RelativeSource Self},Path=(local:DataGridControl.DataGridContext).VerticalGridLineThickness,Converter={StaticResource thicknessConverter},ConverterParameter='Right'}" />

         <local:HierarchicalGroupLevelIndicatorPane Grid.Column="0" />

         <!-- GroupLevelIndicatorPane is a placeholder for individual GroupLevelIndicator elements that are added
                       whenever this Row is part of a group. -->
         <local:GroupLevelIndicatorPane x:Name="groupLevelIndicatorPane"
                                        Grid.Column="1" />

         <Border BorderBrush="{TemplateBinding BorderBrush}"
                 BorderThickness="{TemplateBinding BorderThickness}"
                 Grid.Column="2">

            <Grid>
               <Grid>
                  <Grid.RowDefinitions>
                     <RowDefinition Height="0.53*" />
                     <RowDefinition Height="0.27*" />
                     <RowDefinition Height="0.2*" />
                  </Grid.RowDefinitions>

                  <Border Grid.RowSpan="3">
                     <Border.Background>
                        <LinearGradientBrush StartPoint="0,0.5"
                                             EndPoint="1,0.5">
                           <GradientStop Offset="0"
                                         Color="#044875" />
                           <GradientStop Offset="1"
                                         Color="#196C77" />
                        </LinearGradientBrush>
                     </Border.Background>
                  </Border>

                  <Border Grid.Row="2">
                     <Border.Background>
                        <LinearGradientBrush StartPoint="0.5,0"
                                             EndPoint="0.5,1">
                           <GradientStop Offset="0"
                                         Color="#008CC1C6" />
                           <GradientStop Offset="0.5"
                                         Color="#0F85BDC2" />
                           <GradientStop Offset="0.96"
                                         Color="#AE80BBBF" />
                           <GradientStop Offset="1"
                                         Color="#B280BBBF" />
                        </LinearGradientBrush>
                     </Border.Background>
                  </Border>

                  <Border Grid.Row="0">
                     <Border.Background>
                        <LinearGradientBrush StartPoint="0.5,1"
                                             EndPoint="0.5,0">
                           <GradientStop Offset="0"
                                         Color="#26FFFFFF" />
                           <GradientStop Offset="1"
                                         Color="#B1FFFFFF" />
                           <GradientStop Offset="0.643"
                                         Color="#66FFFFFF" />
                        </LinearGradientBrush>
                     </Border.Background>
                  </Border>

                  <!--This element has to be external to avoid being overlapped by the gradients-->
                  <Border Grid.RowSpan="3"
                          BorderThickness="1"
                          BorderBrush="#093442">

                     <Border Grid.RowSpan="3"
                             BorderThickness="1"
                             BorderBrush="#7FFFFFFF" />
                  </Border>

               </Grid>

               <StackPanel Orientation="Horizontal">

                  <TreeView x:Name="PART_HierarchicalGroupByControlTreeView"
                            ItemContainerStyle="{StaticResource hierarchicalGroupByControlTreeViewItemStyle}"
                            Background="{TemplateBinding Background}"
                            BorderBrush="Transparent"
                            Focusable="False">

                     <TreeViewItem Header="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext)}"
                                   HeaderTemplate="{StaticResource dataGridContextTemplate}"
                                   ItemsSource="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).DetailConfigurations}"
                                   ItemTemplate="{StaticResource detailConfigurationTemplate}"
                                   ItemContainerStyle="{StaticResource hierarchicalGroupByControlTreeViewItemStyle}"
                                   IsExpanded="True" />

                  </TreeView>

                  <!-- This ContentPresenter displays the value of the NoGroupContent property
                 of the GroupByControl. This content must only be displayed when there are
                 no groups present, so we set its Visibility to Collapsed by default and
                 it is made visible via a trigger. -->
                  <ContentPresenter x:Name="noGroupContentPresenter"
                                    Content="{TemplateBinding NoGroupContent}"
                                    VerticalAlignment="Center"
                                    Visibility="Collapsed"
                                    Margin="5,0,0,0" />

               </StackPanel>
               <!-- The GroupByControl is an ItemsControl, so it must have an ItemsPresenter in its
                 Template in order to layout and show its child items. The default ItemsPanel
                 of the GroupByControl is a "StaircasePanel", which layout its items in a
                 staircase-like pattern and draws connecting lines between the items. -->
               <ItemsPresenter Margin="{TemplateBinding Padding}" />

            </Grid>
         </Border>

      </Grid>
      <ControlTemplate.Triggers>
         <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=HasGroups}"
                      Value="True">

            <Setter TargetName="noGroupContentPresenter"
                    Property="Visibility"
                    Value="Visible" />

         </DataTrigger>

         <DataTrigger Binding="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(local:GroupLevelIndicatorPane.GroupLevel)}"
                      Value="-1">
            <Setter TargetName="groupLevelIndicatorPane"
                    Property="Visibility"
                    Value="Collapsed" />
            <Setter TargetName="verticalGridLineBorder"
                    Property="BorderThickness"
                    Value="{Binding RelativeSource={RelativeSource Self},Path=(local:DataGridControl.DataGridContext).VerticalGridLineThickness,Converter={StaticResource thicknessConverter},ConverterParameter='Right, Left'}" />
         </DataTrigger>

      </ControlTemplate.Triggers>

   </ControlTemplate>

   <!--**************************
    * TEMPLATE: HierarchicalGroupByControlNode
    ************************** -->
   <ControlTemplate x:Key="tableflowViewAeroNormalColorHierarchicalGroupByControlNodeTemplate"
                    TargetType="local:HierarchicalGroupByControlNode">

      <StackPanel Orientation="Horizontal"
                  Background="{TemplateBinding Background}"
                  Margin="0,4,0,4">

         <Grid VerticalAlignment="Top"
               HorizontalAlignment="Center"
               Margin="0,0,0,0">

            <Border x:Name="border1"
                    BorderBrush="#1AFFFFFF"
                    CornerRadius="2"
                    BorderThickness="1">

               <Border x:Name="border2"
                       BorderBrush="#80022841"
                       CornerRadius="2"
                       BorderThickness="1">

                  <Border x:Name="border3"
                          BorderBrush="#34FFFFFF"
                          CornerRadius="2"
                          BorderThickness="1">

                     <TextBlock x:Name="titleTextBlock"
                                Text="{TemplateBinding Title}"
                                Foreground="White"
                                Margin="3,0,3,0" />
                  </Border>
               </Border>
            </Border>
         </Grid>

         <ItemsPresenter Margin="2,0,0,0"
                         VerticalAlignment="Bottom"
                         HorizontalAlignment="Right" />

      </StackPanel>

   </ControlTemplate>

   <!--**************************
    * TEMPLATE: HierarchicalGroupByItem 
    ************************** -->
   <ControlTemplate x:Key="aeroNormalColorHierarchicalGroupByItemTemplate"
                    TargetType="local:HierarchicalGroupByItem">

      <Border BorderBrush="{TemplateBinding BorderBrush}"
              BorderThickness="{TemplateBinding BorderThickness}">

         <Grid>
            <Border x:Name="border1"
                    BorderBrush="#1AFFFFFF"
                    CornerRadius="2"
                    BorderThickness="1" />

            <Border x:Name="border2"
                    BorderBrush="#80022841"
                    CornerRadius="2"
                    BorderThickness="1"
                    Margin="1" />

            <Border x:Name="border3"
                    BorderBrush="#34FFFFFF"
                    CornerRadius="2"
                    BorderThickness="1"
                    Margin="2" />

            <Border x:Name="topGradient"
                    Height="17"
                    VerticalAlignment="Top">
               <Border.Background>
                  <LinearGradientBrush StartPoint="0.5,1"
                                       EndPoint="0.503,0.039">
                     <GradientStop Offset="0"
                                   Color="#00FFFFFF" />
                     <GradientStop Offset="1"
                                   Color="#4CFFFFFF" />
                  </LinearGradientBrush>
               </Border.Background>
            </Border>

            <Border x:Name="bottomGradient"
                    Margin="2">
               <Border.Background>
                  <RadialGradientBrush RadiusX="0.550205"
                                       RadiusY="1.03782"
                                       Center="0.487447,1.21575"
                                       GradientOrigin="0.487447,1.21575">
                     <GradientStop Offset="0"
                                   Color="#99FFFFFF" />
                     <GradientStop Offset="0.17"
                                   Color="#99FFFFFF" />
                     <GradientStop Offset="1"
                                   Color="#00FFFFFF" />

                     <RadialGradientBrush.RelativeTransform>
                        <RotateTransform CenterX="0.48747"
                                         CenterY="1.21575"
                                         Angle="-90" />
                     </RadialGradientBrush.RelativeTransform>
                  </RadialGradientBrush>
               </Border.Background>

               <!-- This StackPanel is used to layout the ContentPresenter and the Sort Glyph (when present). -->
               <StackPanel Orientation="Horizontal"
                           Margin="{TemplateBinding Padding}"
                           TextElement.Foreground="White">

                  <ContentPresenter Content="{TemplateBinding Content}"
                                    ContentTemplate="{TemplateBinding ContentTemplate}"
                                    ContentTemplateSelector="{TemplateBinding ContentTemplateSelector}"
                                    HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                    VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />

                  <ContentPresenter x:Name="sortGlyphPresenter"
                                    Margin="6,0,4,0"
                                    Content="{x:Null}"
                                    ContentTemplate="{StaticResource groupByItemAscendingSortGlyph}"
                                    Visibility="Hidden" />

               </StackPanel>

            </Border>
         </Grid>
      </Border>

      <ControlTemplate.Triggers>

         <Trigger Property="IsMouseOver"
                  Value="True">

            <Setter TargetName="border1"
                    Property="BorderBrush"
                    Value="#4DFFFFFF" />

            <Setter TargetName="border2"
                    Property="BorderBrush"
                    Value="#52022841" />

            <Setter TargetName="border3"
                    Property="BorderBrush"
                    Value="#71FFFFFF" />

            <Setter TargetName="topGradient"
                    Property="Background">

               <Setter.Value>
                  <LinearGradientBrush StartPoint="0.503,1.013"
                                       EndPoint="0.503,0.039">
                     <GradientStop Offset="0"
                                   Color="#19FFFFFF" />
                     <GradientStop Offset="1"
                                   Color="#99FFFFFF" />
                  </LinearGradientBrush>

               </Setter.Value>
            </Setter>

            <Setter TargetName="bottomGradient"
                    Property="Background">

               <Setter.Value>
                  <RadialGradientBrush RadiusX="0.550205"
                                       RadiusY="1.03782"
                                       Center="0.487447,1.21575"
                                       GradientOrigin="0.487447,1.21575">
                     <GradientStop Offset="0.0195"
                                   Color="#FFFFFFFF" />
                     <GradientStop Offset="0.169"
                                   Color="#FFFFFFFF" />
                     <GradientStop Offset="1"
                                   Color="#00FFFFFF" />

                     <RadialGradientBrush.RelativeTransform>
                        <RotateTransform CenterX="0.487447"
                                         CenterY="1.21575"
                                         Angle="-90" />
                     </RadialGradientBrush.RelativeTransform>
                  </RadialGradientBrush>
               </Setter.Value>
            </Setter>

         </Trigger>

         <Trigger Property="IsPressed"
                  Value="True">

            <Setter TargetName="border1"
                    Property="BorderBrush"
                    Value="#4DFFFFFF" />

            <Setter TargetName="border2"
                    Property="BorderBrush"
                    Value="#AE022841" />

            <Setter TargetName="border3"
                    Property="BorderBrush">

               <Setter.Value>
                  <LinearGradientBrush StartPoint="0.542,0.999"
                                       EndPoint="0.542,0.0231">
                     <GradientStop Offset="0"
                                   Color="#0A2F3B" />
                     <GradientStop Offset="0.509"
                                   Color="#0A2F3B" />
                     <GradientStop Offset="0.524"
                                   Color="#4D6B79" />
                     <GradientStop Offset="1"
                                   Color="#4D6B79" />
                  </LinearGradientBrush>
               </Setter.Value>
            </Setter>

            <Setter TargetName="topGradient"
                    Property="Background">

               <Setter.Value>
                  <LinearGradientBrush StartPoint="0.503339,1.0131"
                                       EndPoint="0.503339,0.0388058">
                     <GradientStop Offset="0"
                                   Color="#17699EB5" />
                     <GradientStop Offset="1"
                                   Color="#FF5E8799" />
                  </LinearGradientBrush>
               </Setter.Value>
            </Setter>

            <Setter TargetName="bottomGradient"
                    Property="Background">

               <Setter.Value>
                  <RadialGradientBrush RadiusX="0.550205"
                                       RadiusY="1.03782"
                                       Center="0.487447,1.21575"
                                       GradientOrigin="0.487447,1.21575">

                     <GradientStop Offset="0.019"
                                   Color="#FF000000" />
                     <GradientStop Offset="0.169"
                                   Color="#FF000000" />
                     <GradientStop Offset="1"
                                   Color="#33000000" />

                     <RadialGradientBrush.RelativeTransform>
                        <RotateTransform CenterX="0.487447"
                                         CenterY="1.21575"
                                         Angle="-90" />
                     </RadialGradientBrush.RelativeTransform>
                  </RadialGradientBrush>
               </Setter.Value>
            </Setter>

         </Trigger>

         <!-- The following 2 triggers allow the appropriate Sort Glyph to be displayed
              depending on the ParentColumn's SortDirection. -->
         <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=SortDirection}"
                      Value="Ascending">

            <Setter TargetName="sortGlyphPresenter"
                    Property="Visibility"
                    Value="Visible" />

         </DataTrigger>

         <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=SortDirection}"
                      Value="Descending">

            <Setter TargetName="sortGlyphPresenter"
                    Property="ContentPresenter.ContentTemplate"
                    Value="{StaticResource groupByItemDescendingSortGlyph}" />

            <Setter TargetName="sortGlyphPresenter"
                    Property="Visibility"
                    Value="Visible" />

         </DataTrigger>
      </ControlTemplate.Triggers>

   </ControlTemplate>

   <!-- =================================================================== -->
   <!-- Styles required by some grid elements                               -->
   <!-- =================================================================== -->

   <!--**************************
    * STYLE: CellErrorStyle 
    ************************** -->
   <Style x:Key="cellErrorStyle"
          TargetType="local:Cell">

      <Setter Property="Background"
              Value="{StaticResource errorBackgroundBrush}" />

      <Setter Property="Foreground"
              Value="{StaticResource errorForegroundBrush}" />

      <Setter Property="ToolTip"
              Value="{Binding RelativeSource={RelativeSource Self},Path=ValidationError.ErrorContent}" />

      <Style.Triggers>
         <Trigger Property="IsValidationErrorRestrictive"
                  Value="True">
            <Setter Property="Background"
                    Value="{StaticResource errorBackgroundBrush}" />

         </Trigger>

         <Trigger Property="IsValidationErrorRestrictive"
                  Value="False">

            <Setter Property="Foreground"
                    Value="{StaticResource warningForegroundBrush}" />

            <Setter Property="Background"
                    Value="{StaticResource warningBackgroundBrush}" />

         </Trigger>
      </Style.Triggers>

   </Style>

   <!-- =================================================================== -->
   <!-- Keyed Styles of grid elements                                       -->
   <!-- =================================================================== -->

   <!--**************************
    * STYLE: DataGridControl 
    ************************** -->
   <Style x:Key="tableflowViewAeroNormalColorGridControlStyle"
          TargetType="local:DataGridControl">

      <Setter Property="BorderBrush"
              Value="{StaticResource gridControlBorderBrush}" />

      <Setter Property="BorderThickness"
              Value="1" />

      <Setter Property="Background"
              Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" />

      <Setter Property="Foreground"
              Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}" />

      <!-- This is required to display gridlines of uniform thickness -->
      <Setter Property="SnapsToDevicePixels"
              Value="True" />

      <Setter Property="CellErrorStyle"
              Value="{StaticResource cellErrorStyle}" />

      <Setter Property="Template"
              Value="{StaticResource tableflowViewDataGridControlTemplate}" />

   </Style>

   <!--**************************
    * STYLE: DataGridControl (with hosted controls theming)
    ************************** -->
   <Style x:Key="tableflowViewForcedAeroNormalColorGridControlStyle"
          BasedOn="{StaticResource tableflowViewAeroNormalColorGridControlStyle}"
          TargetType="local:DataGridControl">

      <Style.Resources>
         <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
               <markup:FrameworkThemeResourceDictionary Source="/PresentationFramework.Aero;V4.0.0.0;31bf3856ad364e35;component\themes/aero.normalcolor.xaml" />
            </ResourceDictionary.MergedDictionaries>
         </ResourceDictionary>
      </Style.Resources>

   </Style>

   <!--**************************
    * STYLE: RowSelectorPane
    ************************** -->
   <Style x:Key="tableflowViewAeroNormalColorRowSelectorPaneStyle"
          TargetType="local:RowSelectorPane">

      <Setter Property="Background"
              Value="{StaticResource verticalHeaderBackgroundBrush}" />

      <Setter Property="TextElement.Foreground"
              Value="{StaticResource headerForegroundBrush}" />

   </Style>

   <!--**************************
    * STYLE: RowSelector 
    ************************** -->
   <conv:TypeToBooleanConverter x:Key="rowTypeConverter" />
   <Style x:Key="tableflowViewAeroNormalColorRowSelectorStyle"
          TargetType="local:RowSelector">

      <!-- Set the RowSelector's background to Transparent to make it hit-testable
           while preserving the background drawn by the underlying RowSelectorPane. -->
      <Setter Property="Background"
              Value="Transparent" />

      <Setter Property="BorderBrush"
              Value="{StaticResource rowSelectorBorderBrush}" />

      <Setter Property="BorderThickness"
              Value="1" />

      <Setter Property="HorizontalContentAlignment"
              Value="Center" />

      <Setter Property="VerticalContentAlignment"
              Value="Top" />

      <Setter Property="Padding"
              Value="2" />

      <Setter Property="Template"
              Value="{StaticResource tableflowViewRowSelectorTemplate}" />

      <Style.Triggers>

         <!-- The DataContext of a RowSelector is always set to its corresponding
              Row/item. This is why we use DataTriggers with no explicit Binding Source
              when we want to react to properties of the Row/item. -->

         <!-- When the Row is Current, display the current glyph in the RowSelector -->
         <MultiDataTrigger>
            <MultiDataTrigger.Conditions>
               <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=IsCurrent}"
                          Value="True" />
            </MultiDataTrigger.Conditions>
            <Setter Property="ContentTemplate"
                    Value="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).CurrentItemGlyph}" />
         </MultiDataTrigger>

         <!-- When the Row is being edited, display the appropriate glyph in the RowSelector. -->
         <Trigger Property="IsBeingEdited"
                  Value="True">
            <Setter Property="ContentTemplate"
                    Value="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).EditingRowGlyph}" />

         </Trigger>

         <!-- When the Row has a validation error, display the appropriate glyph in the RowSelector. -->
         <Trigger Property="HasValidationError"
                  Value="True">
            <Setter Property="ContentTemplate"
                    Value="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).ValidationErrorGlyph}" />
         </Trigger>

      </Style.Triggers>
   </Style>

   <!--**************************
    * STYLE: Row Style
    ************************** -->
   <Style x:Key="tableflowViewAeroNormalColorRowStyle"
          TargetType="local:Row">

      <Setter Property="FocusVisualStyle"
              Value="{StaticResource tableflowViewRowFocusVisualStyle}" />

      <Setter Property="SelectionBackground"
              Value="{StaticResource selectionInnerRowBackgroundBrush}" />

      <Setter Property="SelectionForeground"
              Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}" />

      <Setter Property="InactiveSelectionBackground"
              Value="{StaticResource inactiveSelectionInnerRowBackgroundBrush}" />

      <Setter Property="InactiveSelectionForeground"
              Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}" />

      <!-- The Row is responsible for drawing the horizontal gridlines. It draws only its top gridline,
           assuming that the bottom gridline will be drawn by its following row/element -->

      <Setter Property="BorderThickness"
              Value="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).HorizontalGridLineThickness, Converter={StaticResource thicknessConverter}, ConverterParameter='Top'}" />

      <Setter Property="BorderBrush"
              Value="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).HorizontalGridLineBrush}" />

      <Setter Property="Background"
              Value="Transparent" />

      <Setter Property="Foreground"
              Value="{Binding RelativeSource={RelativeSource Self}, Path=ParentForeground}" />

      <Setter Property="Template"
              Value="{StaticResource tableflowViewRowTemplate}" />

      <Style.Triggers>
         <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=(views:ViewBase.IsLastItem)}"
                      Value="True">
            <Setter Property="BorderThickness"
                    Value="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).HorizontalGridLineThickness, Converter={StaticResource thicknessConverter}, ConverterParameter='Top, Bottom'}" />
         </DataTrigger>

         <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.HasExpandedDetails)}"
                      Value="True">
            <Setter Property="BorderThickness"
                    Value="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).HorizontalGridLineThickness, Converter={StaticResource thicknessConverter}, ConverterParameter='Top, Bottom'}" />

         </DataTrigger>

         <!-- Enabled/Disabled Odd datarow style alternation -->
         <MultiDataTrigger>
            <MultiDataTrigger.Conditions>
               <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).IsAlternatingRowStyleEnabled}"
                          Value="True" />
               <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridVirtualizingPanel.ItemIndex), Converter={x:Static conv:IndexToOddConverter.Singleton}}"
                          Value="True" />
            </MultiDataTrigger.Conditions>

            <Setter Property="Background"
                    Value="#F1F2F4" />

         </MultiDataTrigger>
      </Style.Triggers>

   </Style>

   <!--**************************
    * STYLE: DataRow 
    ************************** -->
   <Style x:Key="tableflowViewAeroNormalColorDataRowStyle"
          TargetType="local:DataRow"
          BasedOn="{StaticResource tableflowViewAeroNormalColorRowStyle}">
   </Style>

   <!--**************************
    * STYLE: ColumnManagerRow 
    ************************** -->
   <Style x:Key="tableflowViewAeroNormalColorColumnManagerRowStyle"
          TargetType="local:ColumnManagerRow"
          BasedOn="{StaticResource tableflowViewAeroNormalColorRowStyle}">

      <!-- Use a different background and foreground than the base Row style. -->
      <Setter Property="Background"
              Value="{StaticResource horizontalHeaderBackgroundBrush}" />

      <Setter Property="Foreground"
              Value="{StaticResource headerForegroundBrush}" />

      <!-- We don't want to display a RowSelector for the ColumnManagerRow. -->
      <Setter Property="local:RowSelector.Visible"
              Value="False" />

      <Setter Property="Template"
              Value="{StaticResource tableflowViewColumnManagerRowTemplate}" />

      <Style.Triggers>
         <Trigger Property="local:GroupLevelIndicatorPane.GroupLevel"
                  Value="-1">
            <!-- We don't want to display the Group Margins for the ColumnManagerRow. -->
            <Setter Property="local:GroupLevelIndicatorPane.ShowIndicators"
                    Value="False" />
         </Trigger>
      </Style.Triggers>

   </Style>

   <!--**************************
    * STYLE: Cell
    ************************** -->
   <Style x:Key="tableflowViewAeroNormalColorCellStyle"
          TargetType="local:Cell">

      <Setter Property="CurrentBackground"
              Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" />

      <Setter Property="CurrentForeground"
              Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}" />

      <Setter Property="SelectionBackground"
              Value="{StaticResource selectionInnerRowBackgroundBrush}" />

      <Setter Property="SelectionForeground"
              Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}" />

      <Setter Property="InactiveSelectionBackground"
              Value="{StaticResource inactiveSelectionInnerRowBackgroundBrush}" />

      <Setter Property="InactiveSelectionForeground"
              Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}" />

      <!-- Set the Cell's background to Transparent to make it hit-testable
           while preserving the background drawn by the underlying Row. -->
      <Setter Property="Background"
              Value="Transparent" />

      <Setter Property="Foreground"
              Value="{Binding RelativeSource={RelativeSource Self}, Path=ParentForeground}" />

      <!-- In TableflowView, each Cell has the same width as its ParentColum's ActualWidth -->
      <Setter Property="Width"
              Value="{Binding RelativeSource={RelativeSource Self}, Path=ParentColumn.ActualWidth}" />

      <Setter Property="Padding"
              Value="{StaticResource cellPadding}" />

      <Setter Property="HorizontalContentAlignment"
              Value="{Binding RelativeSource={RelativeSource Self}, Path=ParentColumn.CellHorizontalContentAlignment, FallbackValue=Stretch}" />

      <Setter Property="VerticalContentAlignment"
              Value="{Binding RelativeSource={RelativeSource Self}, Path=ParentColumn.CellVerticalContentAlignment, FallbackValue=Stretch}" />

      <!-- The Cell is responsible for drawing the vertical gridlines. It draws only its right gridline, 
           assuming that the left gridline will have been drawn by its preceding cell -->

      <Setter Property="BorderThickness"
              Value="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).VerticalGridLineThickness, Converter={StaticResource thicknessConverter}, ConverterParameter='Right'}" />

      <Setter Property="BorderBrush"
              Value="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).VerticalGridLineBrush}" />

      <Setter Property="Template"
              Value="{StaticResource tableflowViewCellTemplate}" />

   </Style>

   <!--**************************
    * STYLE: DataCell
    ************************** -->
   <Style x:Key="tableflowViewAeroNormalColorDataCellStyle"
          TargetType="local:DataCell"
          BasedOn="{StaticResource tableflowViewAeroNormalColorCellStyle}" />

   <!--**************************
    * STYLE: ColumnManagerCell 
    ************************** -->
   <Style x:Key="tableflowViewAeroNormalColorColumnManagerCellStyle"
          TargetType="local:ColumnManagerCell">

      <Setter Property="BorderBrush"
              Value="{StaticResource columnManagerCellBorderBrush}" />

      <Setter Property="BorderThickness"
              Value="1" />

      <Setter Property="Background"
              Value="Transparent" />

      <!-- In TableflowView, each Cell has the same width as its ParentColum's ActualWidth -->
      <Setter Property="Width"
              Value="{Binding RelativeSource={RelativeSource Self},Path=ParentColumn.ActualWidth}" />

      <Setter Property="Padding"
              Value="{StaticResource columnManagerCellPadding}" />

      <Setter Property="HorizontalContentAlignment"
              Value="{Binding RelativeSource={RelativeSource Self}, Path=ParentColumn.CellHorizontalContentAlignment, FallbackValue=Stretch}" />

      <Setter Property="VerticalContentAlignment"
              Value="{Binding RelativeSource={RelativeSource Self}, Path=ParentColumn.CellVerticalContentAlignment, FallbackValue=Stretch}" />

      <Setter Property="Template"
              Value="{StaticResource tableflowViewColumnManagerCellTemplate}" />

   </Style>

   <!--**************************
    * STYLE: GroupByControl 
    ************************** -->
   <Style x:Key="tableflowViewAeroNormalColorGroupByControlStyle"
          TargetType="local:GroupByControl">

      <Setter Property="Foreground"
              Value="{StaticResource groupByControlForegroundBrush}" />

      <!-- If we don't specify a MinHeight, the default "size-to-content" behavior will arrange 
           the control with a Height of 0, which makes it invisible and unusable.
           In a typical TableflowView, a height of at least 25 is appropriate for the GroupByControl. -->
      <Setter Property="MinHeight"
              Value="25" />

      <Setter Property="Padding"
              Value="8" />

      <Setter Property="local:RowSelector.Visible"
              Value="False" />

      <Setter Property="views:TableView.CanScrollHorizontally"
              Value="False" />

      <Setter Property="Template"
              Value="{StaticResource aeroNormalColorGroupByControlTemplate}" />

   </Style>

   <!--**************************
    * STYLE: GroupByItem
    ************************** -->
   <Style x:Key="tableflowViewAeroNormalColorGroupByItemStyle"
          TargetType="local:GroupByItem">

      <Setter Property="Padding"
              Value="{StaticResource columnManagerCellPadding}" />

      <Setter Property="Template"
              Value="{StaticResource aeroNormalColorGroupByItemTemplate}" />

   </Style>

   <!--**************************
    * STYLE: GroupHeaderControl 
    ************************** -->
   <Style x:Key="tableflowViewAeroNormalColorGroupHeaderControlStyle"
          TargetType="local:GroupHeaderControl">

      <!-- Set the GroupHeaderControl's background to Transparent to make it hit-testable. -->
      <Setter Property="Background"
              Value="Transparent" />

      <Setter Property="BorderThickness"
              Value="1" />      

      <Setter Property="Padding"
              Value="{StaticResource cellPadding}" />

      <Setter Property="VerticalContentAlignment"
              Value="Center" />

      <Setter Property="views:TableView.CanScrollHorizontally"
              Value="False" />

      <Setter Property="SelectionBackground"
              Value="{StaticResource selectionInnerRowBackgroundBrush}" />

      <Setter Property="SelectionForeground"
              Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}" />

      <Setter Property="InactiveSelectionBackground"
              Value="{StaticResource inactiveSelectionInnerRowBackgroundBrush}" />

      <Setter Property="InactiveSelectionForeground"
              Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}" />

      <!-- The GroupHeaderControl itself must not be focusable. The main Border inside its Template will
           be made Focusable because it holds the various InputBindings that make the
           GroupHeaderControl work. -->
      <Setter Property="Focusable"
              Value="False" />

      <Setter Property="Template"
              Value="{StaticResource tableflowViewGroupHeaderControlTemplate}" />

      <Style.Triggers>
         <MultiDataTrigger>
            <MultiDataTrigger.Conditions>
               <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=Content.IsBottomLevel}"
                          Value="False" />
               <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=Content.Level}"
                          Value="0" />
               <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).AreGroupHeadersSticky}"
                          Value="True" />
               <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).AreGroupsFlattened}"
                          Value="True" />
            </MultiDataTrigger.Conditions>

            <Setter Property="Template"
                    Value="{StaticResource tableflowViewGroupHeaderTopLevelStickyControlTemplate}" />

            <Setter Property="Foreground"
                    Value="White" />
         </MultiDataTrigger>
      </Style.Triggers>

   </Style>

   <!--**************************
    * STYLE: GroupLevelIndicator
    ************************** -->
   <Style x:Key="tableflowViewAeroNormalColorGroupLevelIndicatorStyle"
          TargetType="local:GroupLevelIndicator">

      <Setter Property="Width"
              Value="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).GroupLevelIndicatorWidth}" />

      <Setter Property="Template"
              Value="{StaticResource tableflowViewGroupLevelIndicatorTemplate}" />

   </Style>

   <!--**************************
    * STYLE: DetailIndicator
    ************************** -->
   <Style x:Key="tableflowViewAeroNormalColorDetailIndicatorStyle"
          TargetType="local:DetailIndicator">

      <Setter Property="Background"
              Value="{x:Null}" />

      <Setter Property="Width"
              Value="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).DetailIndicatorWidth}" />

      <Setter Property="Template"
              Value="{StaticResource tableflowViewDetailIndicatorTemplate}" />

   </Style>

   <!--**************************
    * STYLE: GroupLevelIndicatorPane
    ************************** -->
   <Style x:Key="tableflowViewAeroNormalColorGroupLevelIndicatorPaneStyle"
          TargetType="local:GroupLevelIndicatorPane">

      <Setter Property="Template"
              Value="{StaticResource tableflowViewGroupLevelIndicatorPaneTemplate}" />

      <Style.Triggers>
         <MultiTrigger>
            <MultiTrigger.Conditions>
               <Condition Property="IsLeaf"
                          Value="False" />
               <Condition Property="views:ViewBase.IsLastItem"
                          Value="True" />
            </MultiTrigger.Conditions>

            <Setter Property="Margin"
                    Value="0,0,0,-5" />
         </MultiTrigger>

      </Style.Triggers>
   </Style>

   <!--**************************
    * STYLE: HierarchicalGroupLevelIndicatorPane
    ************************** -->
   <Style x:Key="tableflowViewAeroNormalColorHierarchicalGroupLevelIndicatorPaneStyle"
          TargetType="local:HierarchicalGroupLevelIndicatorPane">

      <Setter Property="Template"
              Value="{StaticResource tableflowViewHierarchicalGroupLevelIndicatorPaneTemplate}" />

      <Setter Property="local:GroupLevelIndicatorPane.ShowIndicators"
              Value="True" />

      <Setter Property="local:GroupLevelIndicatorPane.ShowVerticalBorder"
              Value="True" />

      <Style.Triggers>
         <Trigger Property="local:GroupLevelIndicatorPane.GroupLevel"
                  Value="-1">

            <!-- Stop the propagation of the value set by the default style trigger of
                 the ColumnManagerRow -->
            <Setter Property="local:GroupLevelIndicatorPane.ShowIndicators"
                    Value="True" />

         </Trigger>
      </Style.Triggers>
   </Style>

   <!--**************************
    * STYLE: HierarchicalGroupByControlNode
    ************************** -->
   <Style x:Key="tableflowViewAeroNormalColorHierarchicalGroupByControlNodeStyle"
          TargetType="local:HierarchicalGroupByControlNode">

      <Setter Property="StairHeight"
              Value="0" />

      <Setter Property="ConnectionLineOffset"
              Value="0" />

      <Setter Property="ConnectionLineAlignment"
              Value="CenterToCenter" />

      <Setter Property="Template"
              Value="{StaticResource tableflowViewAeroNormalColorHierarchicalGroupByControlNodeTemplate}" />

   </Style>

   <!--**************************
    * STYLE: HierarchicalGroupByControl
    ************************** -->
   <Style x:Key="tableflowViewAeroNormalColorHierarchicalGroupByControlStyle"
          TargetType="local:HierarchicalGroupByControl">

      <!-- The Background property must be set for DragManager to work properly -->
      <Setter Property="Background"
              Value="Transparent" />

      <Setter Property="Foreground"
              Value="White" />

      <Setter Property="Focusable"
              Value="False" />

      <Setter Property="StairHeight"
              Value="0" />

      <Setter Property="ConnectionLineOffset"
              Value="0" />

      <Setter Property="ConnectionLineAlignment"
              Value="CenterToCenter" />

      <Setter Property="ConnectionLinePen"
              Value="{StaticResource groupByConnectionLinePen}" />

      <Setter Property="local:RowSelector.Visible"
              Value="False" />

      <Setter Property="views:TableView.CanScrollHorizontally"
              Value="False" />

      <Setter Property="Template"
              Value="{StaticResource tableflowViewAeroNormalColorHierarchicalGroupByControlTemplate}" />

      <Style.Triggers>

         <!-- We use the old GroupByControl Template if there are no Details in the DataGridControl.ItemsSource -->
         <MultiDataTrigger>
            <MultiDataTrigger.Conditions>

               <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).HasDetails}"
                          Value="False" />

               <Condition Binding="{Binding RelativeSource={RelativeSource Self}, Path=(local:DataGridControl.DataGridContext).ParentDataGridContext, Converter={StaticResource nullToBooleanConverter}}"
                          Value="True" />

            </MultiDataTrigger.Conditions>

            <Setter Property="Template"
                    Value="{StaticResource tableflowViewCommonHierarchicalGroupByControlOldGroupByControlTemplate}" />

         </MultiDataTrigger>

      </Style.Triggers>

   </Style>

   <!--**************************
    * STYLE: HierarchicalGroupByItem
    ************************** -->
   <Style x:Key="tableflowViewAeroNormalColorHierarchicalGroupByItemStyle"
          TargetType="local:HierarchicalGroupByItem">

      <!--The Background property must be set for DragManager to work properly-->
      <Setter Property="Background"
              Value="Transparent" />

      <Setter Property="Padding"
              Value="{StaticResource columnManagerCellPadding}" />

      <Setter Property="Margin"
              Value="4,0,4,0" />

      <Setter Property="Template"
              Value="{StaticResource aeroNormalColorHierarchicalGroupByItemTemplate}" />

   </Style>

   <!--**************************
    * STYLE: GroupNavigationControl
    ************************** -->
   <Style x:Key="tableflowViewAeroNormalColorGroupNavigationControlStyle"
          TargetType="local:GroupNavigationControl">
      <Setter Property="Template"
              Value="{StaticResource tableflowViewGroupNavigationControlTemplate}" />
   </Style>

   <!--**************************
    * STYLE: GroupNavigationControlItem
    ************************** -->
   <Style x:Key="tableflowViewAeroNormalColorGroupNavigationControlItemStyle"
          TargetType="{x:Type local:GroupNavigationControlItem}">

      <Setter Property="Template">
         <Setter.Value>
            <ControlTemplate TargetType="{x:Type local:GroupNavigationControlItem}">
               <Grid SnapsToDevicePixels="true">
                  <Border x:Name="Border"
                          Background="Transparent" />
                  <Border Margin="2">
                     <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                       VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
                  </Border>
               </Grid>
               <ControlTemplate.Triggers>

                  <!-- Change IsSelected SelectedBackgroundBrush to set the selection color for the items -->
                  <Trigger Property="IsMouseOver"
                           Value="true">
                     <Setter Property="Background"
                             TargetName="Border"
                             Value="{DynamicResource {x:Static SystemColors.HighlightBrushKey}}" />

                     <Setter Property="Foreground"
                             Value="Black" />
                  </Trigger>

                  <Trigger Property="IsEnabled"
                           Value="false">
                     <Setter Property="Foreground"
                             Value="Gray" />
                  </Trigger>
               </ControlTemplate.Triggers>
            </ControlTemplate>
         </Setter.Value>
      </Setter>
   </Style>

   <!--**************************
    * STYLE: GroupNavigationButton
    ************************** -->
   <Style x:Key="tableflowViewAeroNormalColorGroupNavigationButtonStyle"
          TargetType="local:GroupNavigationButton">
      <Setter Property="Template"
              Value="{StaticResource tableflowViewGroupNavigationButtonTemplate}" />
   </Style>

   <!--**************************
    * STYLE: ScrollTip
    ************************** -->
   <Style x:Key="tableflowViewAeroNormalColorScrollTipStyle"
          TargetType="local:ScrollTip">

      <Setter Property="Template"
              Value="{StaticResource scrollTipTemplate}" />

      <Setter Property="Background">
         <Setter.Value>
            <LinearGradientBrush StartPoint="0.5,1"
                                 EndPoint="0.5,0">
               <GradientStop Color="#FFA9DAF6"
                             Offset="0" />

               <GradientStop Color="#FFD9F0FC"
                             Offset="0.5" />

               <GradientStop Color="#FFE8F5FD"
                             Offset="1" />
            </LinearGradientBrush>
         </Setter.Value>
      </Setter>

      <Setter Property="BorderBrush"
              Value="#FF3C7FB1" />

      <Setter Property="TextElement.Foreground"
              Value="Black" />

      <Setter Property="VerticalAlignment"
              Value="Center" />

      <Setter Property="HorizontalAlignment"
              Value="Right" />

   </Style>

   <!-- =================================================================== -->
   <!-- Default values for the View                                         -->
   <!-- =================================================================== -->

   <Style x:Key="tableflowViewAeroNormalColorDefaultValues"
          TargetType="views:TableflowView">

      <Setter Property="GroupLevelIndicatorWidth"
              Value="17" />

      <Setter Property="DetailIndicatorWidth"
              Value="34" />

      <Setter Property="DefaultDropMarkPen"
              Value="{StaticResource dropMarkPen}" />

      <Setter Property="VerticalGridLineBrush"
              Value="{StaticResource hotRowBorderBrush}" />

      <Setter Property="VerticalGridLineThickness"
              Value="0" />

      <Setter Property="HorizontalGridLineBrush"
              Value="{StaticResource hotRowBorderBrush}" />

      <Setter Property="HorizontalGridLineThickness"
              Value="0" />

      <!-- Those glyphs are null by default on ViewBase, so every Theme should define
           and set their own custom glyphs. -->

      <Setter Property="AscendingSortGlyph"
              Value="{StaticResource ascendingSortGlyph}" />

      <Setter Property="DescendingSortGlyph"
              Value="{StaticResource descendingSortGlyph}" />

      <Setter Property="ExpandGroupGlyph"
              Value="{StaticResource expandGroupGlyph}" />

      <Setter Property="CollapseGroupGlyph"
              Value="{StaticResource collapseGroupGlyph}" />

      <Setter Property="CurrentItemGlyph"
              Value="{StaticResource currentItemGlyph}" />

      <Setter Property="EditingRowGlyph"
              Value="{StaticResource editingRowGlyph}" />

      <Setter Property="ValidationErrorGlyph"
              Value="{StaticResource validationErrorGlyph}" />

      <Setter Property="ConnectionStateLoadingGlyph"
              Value="{StaticResource connectionStateLoadingGlyph}" />

      <Setter Property="ConnectionStateCommittingGlyph"
              Value="{StaticResource connectionStateLoadingGlyph}" />

      <Setter Property="ConnectionStateErrorGlyph"
              Value="{StaticResource connectionStateErrorGlyph}" />
   </Style>

   <!-- =================================================================== -->
   <!-- DefaultStyleKey declarations                                        -->
   <!-- =================================================================== -->

   <Style x:Key="{markup:ThemeKey TargetViewType=views:TableflowView, ThemeType=views:AeroNormalColorTheme}"
          TargetType="views:TableflowView"
          BasedOn="{StaticResource tableflowViewAeroNormalColorDefaultValues}" />

   <Style x:Key="{markup:ThemeKey TargetViewType=views:TableflowView, ThemeType=views:AeroNormalColorTheme, TargetElementType=local:DataGridControl}"
          TargetType="local:DataGridControl"
          BasedOn="{StaticResource tableflowViewForcedAeroNormalColorGridControlStyle}" />

   <Style x:Key="{markup:ThemeKey TargetViewType=views:TableflowView, ThemeType=views:AeroNormalColorTheme, TargetElementType=local:RowSelectorPane}"
          TargetType="local:RowSelectorPane"
          BasedOn="{StaticResource tableflowViewAeroNormalColorRowSelectorPaneStyle}" />

   <Style x:Key="{markup:ThemeKey TargetViewType=views:TableflowView, ThemeType=views:AeroNormalColorTheme, TargetElementType=local:RowSelector}"
          TargetType="local:RowSelector"
          BasedOn="{StaticResource tableflowViewAeroNormalColorRowSelectorStyle}" />

   <Style x:Key="{markup:ThemeKey TargetViewType=views:TableflowView, ThemeType=views:AeroNormalColorTheme, TargetElementType=local:Row}"
          TargetType="local:Row"
          BasedOn="{StaticResource tableflowViewAeroNormalColorRowStyle}" />

   <Style x:Key="{markup:ThemeKey TargetViewType=views:TableflowView, ThemeType=views:AeroNormalColorTheme, TargetElementType=local:DataRow}"
          TargetType="local:DataRow"
          BasedOn="{StaticResource tableflowViewAeroNormalColorDataRowStyle}" />

   <Style x:Key="{markup:ThemeKey TargetViewType=views:TableflowView, ThemeType=views:AeroNormalColorTheme, TargetElementType=local:ColumnManagerRow}"
          TargetType="local:ColumnManagerRow"
          BasedOn="{StaticResource tableflowViewAeroNormalColorColumnManagerRowStyle}" />

   <Style x:Key="{markup:ThemeKey TargetViewType=views:TableflowView, ThemeType=views:AeroNormalColorTheme, TargetElementType=local:Cell}"
          TargetType="local:Cell"
          BasedOn="{StaticResource tableflowViewAeroNormalColorCellStyle}" />

   <Style x:Key="{markup:ThemeKey TargetViewType=views:TableflowView, ThemeType=views:AeroNormalColorTheme, TargetElementType=local:DataCell}"
          TargetType="local:DataCell"
          BasedOn="{StaticResource tableflowViewAeroNormalColorDataCellStyle}" />

   <Style x:Key="{markup:ThemeKey TargetViewType=views:TableflowView, ThemeType=views:AeroNormalColorTheme, TargetElementType=local:ColumnManagerCell}"
          TargetType="local:ColumnManagerCell"
          BasedOn="{StaticResource tableflowViewAeroNormalColorColumnManagerCellStyle}" />

   <Style x:Key="{markup:ThemeKey TargetViewType=views:TableflowView, ThemeType=views:AeroNormalColorTheme, TargetElementType=local:GroupByControl}"
          TargetType="local:GroupByControl"
          BasedOn="{StaticResource tableflowViewAeroNormalColorGroupByControlStyle}" />

   <Style x:Key="{markup:ThemeKey TargetViewType=views:TableflowView, ThemeType=views:AeroNormalColorTheme, TargetElementType=local:GroupByItem}"
          TargetType="local:GroupByItem"
          BasedOn="{StaticResource tableflowViewAeroNormalColorGroupByItemStyle}" />

   <Style x:Key="{markup:ThemeKey TargetViewType=views:TableflowView, ThemeType=views:AeroNormalColorTheme, TargetElementType=local:GroupHeaderControl}"
          TargetType="local:GroupHeaderControl"
          BasedOn="{StaticResource tableflowViewAeroNormalColorGroupHeaderControlStyle}" />

   <Style x:Key="{markup:ThemeKey TargetViewType=views:TableflowView, ThemeType=views:AeroNormalColorTheme, TargetElementType=local:GroupLevelIndicator}"
          TargetType="local:GroupLevelIndicator"
          BasedOn="{StaticResource tableflowViewAeroNormalColorGroupLevelIndicatorStyle}" />

   <Style x:Key="{markup:ThemeKey TargetViewType=views:TableflowView, ThemeType=views:AeroNormalColorTheme, TargetElementType=local:DetailIndicator}"
          TargetType="local:DetailIndicator"
          BasedOn="{StaticResource tableflowViewAeroNormalColorDetailIndicatorStyle}" />

   <Style x:Key="{markup:ThemeKey TargetViewType=views:TableflowView, ThemeType=views:AeroNormalColorTheme, TargetElementType=local:GroupLevelIndicatorPane}"
          TargetType="local:GroupLevelIndicatorPane"
          BasedOn="{StaticResource tableflowViewAeroNormalColorGroupLevelIndicatorPaneStyle}" />

   <Style x:Key="{markup:ThemeKey TargetViewType=views:TableflowView, ThemeType=views:AeroNormalColorTheme, TargetElementType=local:HierarchicalGroupLevelIndicatorPane}"
          TargetType="local:HierarchicalGroupLevelIndicatorPane"
          BasedOn="{StaticResource tableflowViewAeroNormalColorHierarchicalGroupLevelIndicatorPaneStyle}" />

   <Style x:Key="{markup:ThemeKey TargetViewType=views:TableflowView, ThemeType=views:AeroNormalColorTheme, TargetElementType=local:ScrollTip}"
          TargetType="local:ScrollTip"
          BasedOn="{StaticResource tableflowViewAeroNormalColorScrollTipStyle}" />

   <Style x:Key="{markup:ThemeKey TargetViewType=views:TableflowView, ThemeType=views:AeroNormalColorTheme, TargetElementType=local:HierarchicalGroupByControl}"
          TargetType="local:HierarchicalGroupByControl"
          BasedOn="{StaticResource tableflowViewAeroNormalColorHierarchicalGroupByControlStyle}" />

   <Style x:Key="{markup:ThemeKey TargetViewType=views:TableflowView, ThemeType=views:AeroNormalColorTheme, TargetElementType=local:HierarchicalGroupByControlNode}"
          TargetType="local:HierarchicalGroupByControlNode"
          BasedOn="{StaticResource tableflowViewAeroNormalColorHierarchicalGroupByControlNodeStyle}" />

   <Style x:Key="{markup:ThemeKey TargetViewType=views:TableflowView, ThemeType=views:AeroNormalColorTheme, TargetElementType=local:HierarchicalGroupByItem}"
          TargetType="local:HierarchicalGroupByItem"
          BasedOn="{StaticResource tableflowViewAeroNormalColorHierarchicalGroupByItemStyle}" />

   <Style x:Key="{markup:ThemeKey TargetViewType=views:TableflowView, ThemeType=views:AeroNormalColorTheme, TargetElementType=local:GroupNavigationButton}"
          TargetType="local:GroupNavigationButton"
          BasedOn="{StaticResource tableflowViewAeroNormalColorGroupNavigationButtonStyle}" />

   <Style x:Key="{markup:ThemeKey TargetViewType=views:TableflowView, ThemeType=views:AeroNormalColorTheme, TargetElementType=local:GroupNavigationControl}"
          TargetType="local:GroupNavigationControl"
          BasedOn="{StaticResource tableflowViewAeroNormalColorGroupNavigationControlStyle}" />

   <Style x:Key="{markup:ThemeKey TargetViewType=views:TableflowView, ThemeType=views:AeroNormalColorTheme, TargetElementType=local:GroupNavigationControlItem}"
          TargetType="local:GroupNavigationControlItem"
          BasedOn="{StaticResource tableflowViewAeroNormalColorGroupNavigationControlItemStyle}" />
</ResourceDictionary>
